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. ;)
 
Back
Top