"be consistent" | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
This is a cheap and optimistic way of extracting numbers from text. It is quite easy to think of cases where this won't work, but there are tons of real-life cases where it works nicely. I allow for numbers at the end of sentences, like 1.23e3. I certainly don't handle expressions like 1.2+3.4-5.6. This was chosen for simplicity of the regex. Update: Now also handles cases like "123ears" after reading Identifying and parsing numbers.
Previous version was:
Update: petral's excellent advice incorporated. In reply to Extract numbers by tye
|
|