2

I am trying to retrieve the ten digit id number from a textarea.

e.g id no 1234567890

I was trying to use.

preg_match("/('/^[0-9]{10}/')/", $article, $tags);

But it does not work. I appreciate any help.

Thanks.

2 Answers 2

4

Try:

preg_match_all("/\d{10}/", $article, $tags);
Sign up to request clarification or add additional context in comments.

Comments

1
preg_match('/[0-9]{10}/', $article, $tags);

Try that. Or if you have multiple IDs, you can use preg_match_all.

preg_match_all('/[0-9]{10}/', $article, $tags);

1 Comment

Or with preg_match_all, for multi-results

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.