Output:use Modern::Perl; use Parse::Range qw(parse_range); say join ' ', sort {$a <=> $b} parse_range('1-2a,27,150b-170,51d2,670 +-675, 12, 90-97, 99-95');
It will warn you about non-numeric ranges:12 27 90 91 92 93 94 95 96 97 98 99 670 671 672 673 674 675
non-numeric range: '1-2a' at c:/Data/strawberry/perl/site/lib/Parse/Ra +nge.pm line 54. non-numeric range: '150b-170' at c:/Data/strawberry/perl/site/lib/Pars +e/Range.pm line 54. non-numeric range: '51d2' at c:/Data/strawberry/perl/site/lib/Parse/Ra +nge.pm line 54.
CountZero
A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James
My blog: Imperial DeltronicsIn reply to Re: Looking for a flexible regex...
by CountZero
in thread Looking for a flexible regex...
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |