Jump to content
Sign in to follow this  

php pregmatch to filter specific number

Recommended Posts

Hello everyone,

I had used pregmatch to filter code calling with this code :

    		echo 'sorry you cannot use +61 to enter phone number use 123xxxx instead';

it would filter if user giving number +61xxxxxx , but if they put number 2222222 it wouldn't filter and this is correct,

the problem actually when user put number leading with 1 for example 12345678 it would filter or displaying echo.

Q : How to filter so that when user put +61xxx  only not 1xxxxx it would be run?

Note : I provided input field so that user put their number only not with calling code.


Share this post

Link to post
Share on other sites

[61] matches either 6 OR 1 at the beginning. You may want to double check some of your regex.

If you want to avoid having something start with +61 then you can just do this



Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Create New...