http://www.perlmonks.org?node_id=1054869


in reply to Looking for a flexible regex...

my $single_range = qr/(?:\d+-\d+)/amsx; '1-5, 20-250, 37000-41000' =~ /(?: $single_range , [ ]? )* $single_range/msx;