List Info

Thread: "AnyInt" or "(anyint, Anyint)"




"AnyInt" or "(anyint, Anyint)"
user name
2006-05-30 22:18:23
Xicheng Jia wrote:
> Xicheng Jia wrote:
> > Cuperman wrote:
> > > Hi all,
> > > I need a regex to validate a field for
"any integer" OR "(any integer,
> > > any integer)"
> > > So i have this: {[0]*}|{\([0]*.[0]*}
> > This pattern matches only , , or {(0A0000} 
 ^_^ ..... which is
=> sorry, the opening brace is a metacharacter, so it
matches
please neglect the above words, I forgot to remove them from
my
scripts.. ..

___[snip]___
> > completely different from what you wanted as
"any integer" OR (any
> > integer, any integer)
> > (Will double check this pattern after I get to my
office..)
>
___[snip]___
> my $pattern = qr{
>         ^(?:
> # beginning of the string
>             -?(?:\d|[1-9]\d+)
> # any positive or negative integer
>               |
> # or
>             \(
> # any positive integer x and y
>                 (\d|[1-9]\d+)
>                 ,\s*
>                 (\d|[1-9]\d+)
> # grouped in the form of (x, y)
>             \)
=>             (?(?{ $1 >= $2 })(?!))

Just found you want "X > Y" instead of
"X < Y", so the above line
should be changed to:

             (?(?{ $2 >= $1 })(?!))

sorry for such confusions.

Xicheng

> # if x >= y, failed
>         )$
> # end of string
>     }x;
> 
__[snip]__


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

"AnyInt" or "(anyint, Anyint)"
user name
2006-05-31 07:50:35
Thanks Xicheng!! Thats a whole bunch of effort - really
appreciate it.
I'll give it a whirl and let you now how it turns out!!
Best, Mark


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

[1-2]

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