List Info

Thread: Phone Numbers




Phone Numbers
country flaguser name
United States
2007-02-25 13:34:04
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


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Regex" group.
To post to this group, send email to regexgooglegroups.com
To unsubscribe from this group, send email to
regex-unsubscribegooglegroups.com
For more options, visit this group at http://groups.go
ogle.com/group/regex
-~----------~----~----~----~------~----~------~--~---


Re: Phone Numbers
country flaguser name
United States
2007-02-25 14:14:26
"/(?:261|21|96|91)sd/"

should do alright

On Feb 25, 8:34 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.
>
> Something like. 261 1223346, 21 2334456, etc.
>
> How can I do this?
>
> Thanks,
>
> Miguel


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Regex" group.
To post to this group, send email to regexgooglegroups.com
To unsubscribe from this group, send email to
regex-unsubscribegooglegroups.com
For more options, visit this group at http://groups.go
ogle.com/group/regex
-~----------~----~----~----~------~----~------~--~---


Re: Phone Numbers
country flaguser name
United States
2007-02-25 20:25:58
Hi,

This is not working.
Any idea?

Thanks,
Miguel

On Feb 25, 8:14 pm, "Yorian"
<yorianbenja...hotmail.com> wrote:
> "/(?:261|21|96|91)sd/"
>
> should do alright
>
> On Feb 25, 8:34 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.
>
> > Something like. 261 1223346, 21 2334456, etc.
>
> > How can I do this?
>
> > Thanks,
>
> > Miguel


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Regex" group.
To post to this group, send email to regexgooglegroups.com
To unsubscribe from this group, send email to
regex-unsubscribegooglegroups.com
For more options, visit this group at http://groups.go
ogle.com/group/regex
-~----------~----~----~----~------~----~------~--~---


Re: Phone Numbers
country flaguser name
United States
2007-02-26 08:28:17
What kind of input goes in?

"/(?:261|21|96|91)sd/"

works for me.

I did put in a whitespace as you gave in the example, so:

261 1234567 will work, but 2611234567 will not work

On Feb 26, 3:25 am, "shapper" <mdmo...gmail.com> wrote:
> Hi,
>
> This is not working.
> Any idea?
>
> Thanks,
> Miguel
>
> On Feb 25, 8:14 pm, "Yorian"
<yorianbenja...hotmail.com> wrote:
>
> > "/(?:261|21|96|91)sd/"
>
> > should do alright
>
> > On Feb 25, 8:34 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.
>
> > > Something like. 261 1223346, 21 2334456,
etc.
>
> > > How can I do this?
>
> > > Thanks,
>
> > > Miguel


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Regex" group.
To post to this group, send email to regexgooglegroups.com
To unsubscribe from this group, send email to
regex-unsubscribegooglegroups.com
For more options, visit this group at http://groups.go
ogle.com/group/regex
-~----------~----~----~----~------~----~------~--~---


Re: Phone Numbers
country flaguser name
United States
2007-02-27 13:15:20
On Feb 25, 11:34 am, "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.
>
> Something like. 261 1223346, 21 2334456, etc.
>
> How can I do this?

Depends on your input strings, if all are stand-alone
instead embedded
into other texts, then you can use a pattern like:

  ^(?:26?1|9[16])s*d$

which matches numbers starting with 261, 21, 96 or 91, and
followed by
optional zero or more whitespaces, and then followed by 7
numbers.

Regards,
Xicheng


>
> Thanks,
>
> Miguel


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Regex" group.
To post to this group, send email to regexgooglegroups.com
To unsubscribe from this group, send email to
regex-unsubscribegooglegroups.com
For more options, visit this group at http://groups.go
ogle.com/group/regex
-~----------~----~----~----~------~----~------~--~---


Re: Phone Numbers
user name
2007-02-27 23:36:26
Hi Xicheng jia
Try with this
^([261]|[21]|[96]|[91])s*ds*$ &nbsp;  for whole number to mach
 ;([261]|[21]|[96]|[91])s*ds*  &nbsp;  for multiline text to find match group

This regex Match : 261 1234567 , 2611234567, 91 &nbsp; 1234567&nbsp; ,911234567
Doesnt Match: 261-1234567,261 1234, 91 1234sas.........etc

On 2/28/07, Xicheng Jia < xichenggmail.com">xichenggmail.com> wrote:

On Feb 25, 11:34 am, "shapper" < mdmo...gmail.com">mdmo...gmail.com > wrote:
>; Hello,
>;
> I need to create a REGEX which accepts only phone numbers.
&gt;
> 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?

Depends on your input strings, if all are stand-alone instead embedded
into other texts, then you can use a pattern like:

&nbsp; ^(?:26?1|9[16])s*d$

which matches numbers starting with 261, 21, 96 or 91, and followed by
optional zero or more whitespaces, and then followed by 7 numbers.

Regards,
Xicheng


&gt;
> Thanks,
&gt;
> Miguel



  ;`·.¸(¨`·.·´¨) Keep
(¨`·.·´¨)¸.·´ Smiling!
&nbsp; `·.¸.·´

Sanket Pathre
Junier Trainee engineer
Akstech Pvt, Ltd.(Vashi)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Regex" group.
To post to this group, send email to regexgooglegroups.com
To unsubscribe from this group, send email to regex-unsubscribegooglegroups.com
For more options, visit this group at http://groups.google.com/group/regex
-~----------~----~----~----~------~----~------~--~---

Re: Phone Numbers
country flaguser name
United States
2007-02-28 00:49:39
On Feb 27, 9:36 pm, "Sanket Pathre"
<sanketpat...gmail.com> wrote:
> Hi Xicheng jia
> Try with this
> ^([261]|[21]|[96]|[91])s*ds*$    for whole number
to mach
>  ([261]|[21]|[96]|[91])s*ds*     for multiline
text to find match
> group

Hi, Sanket:

([261]|[21]|[96]|[91]) part in your pattern is exactly the
same as
[2169] which matches only a single character. Please check
it
carefully. 

Regards,
Xicheng

> This regex Match : 261 1234567 , 2611234567, 91  
1234567  ,911234567
> Doesnt Match: 261-1234567,261 1234, 91
1234sas.........etc
>
> On 2/28/07, Xicheng Jia <xich...gmail.com> wrote:
>
>
>
>
>
>
>
> > On Feb 25, 11:34 am, "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.
>
> > > Something like. 261 1223346, 21 2334456,
etc.
>
> > > How can I do this?
>
> > Depends on your input strings, if all are
stand-alone instead embedded
> > into other texts, then you can use a pattern
like:
>
> >   ^(?:26?1|9[16])s*d$
>
> > which matches numbers starting with 261, 21, 96 or
91, and followed by
> > optional zero or more whitespaces, and then
followed by 7 numbers.
>
> > Regards,
> > Xicheng
>
> > > Thanks,
>
> > > Miguel
>
> --
>
> (¨`·.·´¨) Always
>   `·.¸(¨`·.·´¨) Keep
> (¨`·.·´¨)¸.·´ Smiling!
>   `·.¸.·´
>
> Sanket Pathre
> Junier Trainee engineer
> Akstech Pvt, Ltd.(Vashi)- Hide quoted text -
>
> - Show quoted text -


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Regex" group.
To post to this group, send email to regexgooglegroups.com
To unsubscribe from this group, send email to
regex-unsubscribegooglegroups.com
For more options, visit this group at http://groups.go
ogle.com/group/regex
-~----------~----~----~----~------~----~------~--~---


Re: Phone Numbers
user name
2007-02-28 23:58:32
Hi Xicheng Jia
([261]|[21]|[96]|[91]) is not same as [2169]
[2169] can match any one of 2,1,6,9
([261]|[21]|[96]|[91]) means in1st group () either 261 or 21 or 96 or 91 if match it will check for s*(empty space zero or more) and then followed by d ie 7digit



On 2/28/07, Xicheng Jia < xichenggmail.com"> xichenggmail.com> wrote:

On Feb 27, 9:36 pm, "Sanket Pathre&quot; < sanketpat...gmail.com">sanketpat...gmail.com> wrote:
>; Hi Xicheng jia
> Try with this
> ^([261]|[21]|[96]|[91])s*ds*$  ; &nbsp;for whole number to mach
>&nbsp; ([261]|[21]|[96]|[91])s*ds*&nbsp; &nbsp;  for multiline text to find match
>; group

Hi, Sanket:

([261]|[21]|[96]|[91]) part in your pattern is exactly the same as
[2169] which matches only a single character. Please check it
carefully.

Regards,
Xicheng

> This regex Match : 261 1234567 , 2611234567, 91 &nbsp; 1234567&nbsp; ,911234567
&gt; Doesnt Match: 261-1234567,261 1234, 91 1234sas.........etc
&gt;
> On 2/28/07, Xicheng Jia < xich...gmail.com"> xich...gmail.com> wrote:
>;
>
>
>
>
>
>
&gt; > On Feb 25, 11:34 am, "shapper" < mdmo...gmail.com">mdmo...gmail.com> wrote:
>; > > Hello,
&gt;
> > > I need to create a REGEX which accepts only phone numbers.
&gt;
> > > 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?
>
> > Depends on your input strings, if all are stand-alone instead embedded
&gt; > into other texts, then you can use a pattern like:
>;
> >   ^(?:26?1|9[16])s*d$
>
> > which matches numbers starting with 261, 21, 96 or 91, and followed by
> > optional zero or more whitespaces, and then followed by 7 numbers.
>
> > Regards,
&gt; > Xicheng
&gt;
> > > Thanks,
&gt;
> > > Miguel
>;
> --
>
&gt; (¨`·.·´¨) Always
>; &nbsp; `·.¸(¨`·.·´¨) Keep
> (¨`·.·´¨)¸.·´ Smiling!
> &nbsp; `·.¸.·´
&gt;
> Sanket Pathre
>; Junier Trainee engineer
&gt; Akstech Pvt, Ltd.(Vashi)- Hide quoted text -
>
>; - Show quoted text -



Akstech Pvt, Ltd.(Vashi)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Regex" group.
To post to this group, send email to regexgooglegroups.com
To unsubscribe from this group, send email to regex-unsubscribegooglegroups.com
For more options, visit this group at http://groups.google.com/group/regex
-~----------~----~----~----~------~----~------~--~---

Re: Phone Numbers
country flaguser name
United States
2007-03-01 00:06:31
On Feb 28, 9:58 pm, "Sanket Pathre"
<sanketpat...gmail.com> wrote:
> Hi Xicheng Jia
> ([261]|[21]|[96]|[91]) is not same as [2169]
> [2169] can match any one of 2,1,6,9
> ([261]|[21]|[96]|[91]) means in1st group () either 261
or 21 or 96 or 91 if

that should be (261|21|96|91) without the square brackets,
or in
another format (26?1|9[61]). the square brackets in
[261],[21],[96],
and [91] make each alternative match exactly only one
character.

Regards,
Xicheng

> match it will check for s*(empty space zero or more)
and then followed by
> d ie 7digit
>
> On 2/28/07, Xicheng Jia <xich...gmail.com> wrote:
>
>
>
>
>
>
>
> > On Feb 27, 9:36 pm, "Sanket Pathre"
<sanketpat...gmail.com> wrote:
> > > Hi Xicheng jia
> > > Try with this
> > > ^([261]|[21]|[96]|[91])s*ds*$    for
whole number to mach
> > >  ([261]|[21]|[96]|[91])s*ds*     for
multiline text to find match
> > > group
>
> > Hi, Sanket:
>
> > ([261]|[21]|[96]|[91]) part in your pattern is
exactly the same as
> > [2169] which matches only a single character.
Please check it
> > carefully. 
>
> > Regards,
> > Xicheng
>
> > > This regex Match : 261 1234567 , 2611234567,
91   1234567  ,911234567
> > > Doesnt Match: 261-1234567,261 1234, 91
1234sas.........etc
>
> > > On 2/28/07, Xicheng Jia <xich...gmail.com> wrote:
>
> > > > On Feb 25, 11:34 am, "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.
>
> > > > > Something like. 261 1223346, 21
2334456, etc.
>
> > > > > How can I do this?
>
> > > > Depends on your input strings, if all
are stand-alone instead embedded
> > > > into other texts, then you can use a
pattern like:
>
> > > >   ^(?:26?1|9[16])s*d$
>
> > > > which matches numbers starting with 261,
21, 96 or 91, and followed by
> > > > optional zero or more whitespaces, and
then followed by 7 numbers.
>
> > > > Regards,
> > > > Xicheng
>
> > > > > Thanks,
>
> > > > > Miguel
>
> > > --
>
> > > (¨`·.·´¨) Always
> > >   `·.¸(¨`·.·´¨) Keep
> > > (¨`·.·´¨)¸.·´ Smiling!
> > >   `·.¸.·´
>
> > > Sanket Pathre
> > > Junier Trainee engineer
> > > Akstech Pvt, Ltd.(Vashi)- Hide quoted text -
>
> > > - Show quoted text -
>
> --
>
> (¨`·.·´¨) Always
>   `·.¸(¨`·.·´¨) Keep
> (¨`·.·´¨)¸.·´ Smiling!
>   `·.¸.·´
>
> Sanket Pathre
> Junier Trainee engineer
> Akstech Pvt, Ltd.(Vashi)- Hide quoted text -
>
> - Show quoted text -


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Regex" group.
To post to this group, send email to regexgooglegroups.com
To unsubscribe from this group, send email to
regex-unsubscribegooglegroups.com
For more options, visit this group at http://groups.go
ogle.com/group/regex
-~----------~----~----~----~------~----~------~--~---


Re: Phone Numbers
user name
2007-03-01 00:18:06
Yes Xicheng Jia
U r write ; that should be without square bracket
^(261|21|96|91)s*ds*$


On 3/1/07, Xicheng Jia < xichenggmail.com">xichenggmail.com> wrote:

On Feb 28, 9:58 pm, "Sanket Pathre&quot; < sanketpat...gmail.com">sanketpat...gmail.com> wrote:
>; Hi Xicheng Jia
> ([261]|[21]|[96]|[91]) is not same as [2169]
>; [2169] can match any one of 2,1,6,9
&gt; ([261]|[21]|[96]|[91]) means in1st group () either 261 or 21 or 96 or 91 if

that should be (261|21|96|91) without the square brackets, or in
another format (26?1|9[61]). the square brackets in [261],[21],[96],
and [91] make each alternative match exactly only one character.

Regards,
Xicheng

&gt; match it will check for s*(empty space zero or more) and then followed by
> d ie 7digit
>;
> On 2/28/07, Xicheng Jia < xich...gmail.com">xich...gmail.com > wrote:
>;
>
>
>
>
>
>
&gt; > On Feb 27, 9:36 pm, "Sanket Pathre&quot; < sanketpat...gmail.com">sanketpat...gmail.com> wrote:
>; > > Hi Xicheng jia
> > > Try with this
> > > ^([261]|[21]|[96]|[91])s*ds*$  ; &nbsp;for whole number to mach
> > >  ([261]|[21]|[96]|[91])s*d{7}s* &nbsp; &nbsp; for multiline text to find match
> > > group
>;
> > Hi, Sanket:
&gt;
> > ([261]|[21]|[96]|[91]) part in your pattern is exactly the same as
> > [2169] which matches only a single character. Please check it
> > carefully.
>
>; > Regards,
&gt; > Xicheng
&gt;
> > > This regex Match : 261 1234567 , 2611234567, 91 &nbsp; 1234567&nbsp; ,911234567
&gt; > > Doesnt Match: 261-1234567,261 1234, 91 1234sas.........etc
>
> > > On 2/28/07, Xicheng Jia < xich...gmail.com">xich...gmail.com> wrote:
>;
> > > > On Feb 25, 11:34 am, "shapper" < mdmo...gmail.com"> mdmo...gmail.com> wrote:
>; > > > > Hello,
>;
> > > > > I need to create a REGEX which accepts only phone numbers.
&gt;
> > > > > The phone numbers start allways with 261, 21, 96 or 91 and have 7
> > > > > numbers after it.
>
&gt; > > > > Something like. 261 1223346, 21 2334456, etc.
>
> > > > > How can I do this?
>
> > > > Depends on your input strings, if all are stand-alone instead embedded
> > > > into other texts, then you can use a pattern like:
>
> > > >   ^(?:26?1|9[16])s*d$
>
> > > > which matches numbers starting with 261, 21, 96 or 91, and followed by
> > > > optional zero or more whitespaces, and then followed by 7 numbers.
&gt;
> > > > Regards,
&gt; > > > Xicheng
&gt;
> > > > > Thanks,
&gt;
> > > > > Miguel
&gt;
> > > --
>
&gt; > > (¨`·.·´¨) Always
>; > >   `·.¸(¨`·.·´¨) Keep
> > > (¨`·.·´¨)¸.·´ Smiling!
&gt; > >   `·.¸.·´
&gt;
> > > Sanket Pathre
&gt; > > Junier Trainee engineer
&gt; > > Akstech Pvt, Ltd.(Vashi)- Hide quoted text -
>
>; > > - Show quoted text -
>
>; --
>
&gt; (¨`·.·´¨) Always
>; &nbsp; `·.¸(¨`·.·´¨) Keep
> (¨`·.·´¨)¸.·´ Smiling!
&gt; &nbsp; `·.¸.·´
&gt;
> Sanket Pathre
>; Junier Trainee engineer
&gt; Akstech Pvt, Ltd.(Vashi)- Hide quoted text -
>
>; - Show quoted text -



Akstech Pvt, Ltd.(Vashi)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Regex" group.
To post to this group, send email to regexgooglegroups.com
To unsubscribe from this group, send email to regex-unsubscribegooglegroups.com
For more options, visit this group at http://groups.google.com/group/regex
-~----------~----~----~----~------~----~------~--~---

[1-10]

about | contact  Other archives ( Real Estate discussion Medical topics )