Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: Need a regex..

by diddy_perl (Novice)
on May 21, 2012 at 14:38 UTC ( [id://971632]=note: print w/replies, xml ) Need Help??


in reply to Need a regex..

Just slightly modified the previous post:

use strict; while (defined(my $data = <DATA>)) { chomp $data; print "Got: ", $data, "\n"; if ($data =~ /[-+]?\d+| # optional sign followed by whole number or [-+]?\d{0,3} # optional sign followed by at most 3 digits (\.\d{1, 3})? # followed by decimal point, and finally by at mo +st 3 digits /x) { print "GOOD\n"; } else { print "BAD\n"; } } __DATA__ 12.12 123.123 0.1 1234.0 1234

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://971632]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (8)
As of 2024-04-24 09:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found