Pathologically Eclectic Rubbish Lister | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
You want to match:
* optional plus/minus * numeric value which can be either * digits optionally followed by a decimal point and more digits * a decimal point followed by digits * one or two characters
I think the following regex should meet these conditions: The issue that makes this ones non-trivial is that the decimal point and digits are either a required element or an optional element depending on the presence of a whole number.
My regex should return a list containing value/unit pairs... If you want to exactly match and retreive you should use: That is either a two-element list with the value and the unit, or an empty list. In reply to Re: Identifying and parsing numbers
by Gilimanjaro
|
|