Regex - Numbers

  • Thread starter Thread starter shapper
  • Start date Start date
S

shapper

Hello,

I need to create a REGEX which accepts only phone numbers.

The phone numbers start allways with 261, 21, 96 or 91 and have 7
numbers after it.

Something like. 261 1223346, 21 2334456, etc.

How can I do this?

Thanks,

Miguel
 
Hello,

I need to create a REGEX which accepts only phone numbers.

The phone numbers start allways with 261, 21, 96 or 91 and have 7
numbers after it.

(261|21|96|91)\s\d{7}
 
Hello,

I need to create a REGEX which accepts only phone numbers.

The phone numbers start allways with 261, 21, 96 or 91 and have 7
numbers after it.

Something like. 261 1223346, 21 2334456, etc.

How can I do this?

Thanks,

Miguel

Try this: (?:261|21|96|91)\d{7}
 
shapper said:
Hello,

I need to create a REGEX which accepts only phone numbers.

The phone numbers start allways with 261, 21, 96 or 91 and have 7
numbers after it.

Something like. 261 1223346, 21 2334456, etc.

How can I do this?

Thanks,

Miguel

If you want to post to several groups, you should make a proper cross
post instead of making separate postings. That way the replies show up
in all groups, and you won't get contradictory answers in different groups.

That way you also won't loose track of the posts so that you post the
same question over and over in the same group. ;)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

REGEX. What am I doing wrong? 11
Regex - Date 5
Simple Regex 3
Insert Spaces 10
Get 2 Strings 5
Regex validation problem 3
Regex 3
Regex Replace. Comma and Dot in Number 2

Back
Top