Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re^3: Need a regex..

by Neighbour (Friar)
on May 21, 2012 at 14:40 UTC ( #971634=note: print w/replies, xml ) Need Help??


in reply to Re^2: Need a regex..
in thread Need a regex..

Edit: Lost the race to Re: Need a regex.., which is also slightly better :)
Try a more grouped approach:
/^([+]|[-])?[0-9]{0,3}(\.[0-9]{1,3})?$/
First the start of the line: ^
then an optional + or - sign, with the + enclosed in [] to avoid interpretation: ([+]|-)?
then 0-3 digits: [0-9]{0,3}
then an optional group of a period followed by 1-3 digits, with the period escaped in another way to avoid interpretation: (\.[0-9]{1,3})?
and finally the end of the line: $

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://971634]
help
Chatterbox?
[Lady_Aleena]: marioroy, it is used in 24 other modules I wrote.
[Lady_Aleena]: GUH! I wrote a script better than I thought! 8)

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (10)
As of 2017-05-29 09:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?