in reply to Identifying and parsing numbers
s/(\D+)$//; my $units = $1;
Then proceed with the more standard problem of recognizing a number. See:
Normalizing your input in this way can be a powerful trick that allows you to more clearly identify and deal with your edge cases. Unless performance is absolutely stupendously crucial there is no reason to implement a monolithic regexp that handles every possibility.
Matt
|
|---|