Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Regex - Numbers

0 views
Skip to first unread message

shapper

unread,
Feb 25, 2007, 4:45:10 PM2/25/07
to
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

Alexey Smirnov

unread,
Feb 25, 2007, 5:10:53 PM2/25/07
to
On Feb 25, 10:45 pm, "shapper" <mdmo...@gmail.com> wrote:
> 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}

Rad [Visual C# MVP]

unread,
Feb 26, 2007, 1:27:43 PM2/26/07
to

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

--
Bits.Bytes
http://bytes.thinkersroom.com

Göran Andersson

unread,
Feb 26, 2007, 8:04:27 PM2/26/07
to

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

--
Göran Andersson
_____
http://www.guffa.com

0 new messages