Just another Perl shrine | |
PerlMonks |
Re^3: compute the occurrence of wordsby Tux (Canon) |
on Feb 13, 2013 at 14:27 UTC ( [id://1018546]=note: print w/replies, xml ) | Need Help?? |
In which case you will also have to define "numbers" :) integers?, floats? e-notation? Roman? Only ASCII-digits, or also other Unicode numerals? Let me assume simple integers and floats represented in ASCII (no triad-sep, radix-sep = '.', so valid numbers include 1234 and 0.23, but not DCVII, 2.34e12 or 1,234,567.00
For a complete regular expression to integers and reals, I'd like to refer to Regexp::Common (see $RE{num}). update: /me just realized that it is overly complex, as \w+ can only match integers without a triad-sep, as . is not included in \w, reducing the loop-line to
Enjoy, Have FUN! H.Merijn
In Section
Seekers of Perl Wisdom
|
|