Welcome to the Monastery | |
PerlMonks |
Re: Re: Matching floats according to perlfaq4by Anonymous Monk |
on Sep 25, 2002 at 12:49 UTC ( [id://200609]=note: print w/replies, xml ) | Need Help?? |
/^([+-]?)(?=\d|\.\d)\d*(\.\d*)?([Ee]([+-]?\d+))?$/
== /^[+-]?(\d+\.\d*|\d*\.\d+)(e[+-]?\d+)?$/iThe look-ahead is to ensure that a '.' on its own isn't matched, but that (eg) '.04' and '4.' is. I'm not sure how correct the latter form is. The e+3, E-2 etc bit may or may not match; I don't think (example) '1.2e' on its own is meaningful.
In Section
Seekers of Perl Wisdom
|
|