in reply to Identifying and parsing numbers
Long ago I came up with Extract numbers as a very simple method for pulling numbers out of text that works in lots of cases.
This thread made me realize that I could make it even simpler while making it more effective. I've updated it to reflect this.
The code now reads: my @numbers= $text =~ /([-+\d.eE]+\d)/g; so you could apply this principle to your situation with my( $number, $units )= $text =~ /([-+\d.eE]+\d)(.*)/; It isn't a perfect solution but I think it is worth considering just for its extreme simplicity.
- tye
|
|---|