Ryan Moszynski wrote: > I need to write some code to allow users to specify which of a whole > bunch of elements(e.g.512/1024) that they want to view. My idea for > how to do this was to have them input a semicolon delimited list, for > example: > > 1-10;25;33;100-250
You will need more than a regex: my $lower; my upper; for my $part ( split /;/, $list ){ if( $part =~ /(\d+)-(\d+)/ ){ $lower = $1; $upper = $2; }elsif( $part =~ /(\d+)/ ){ $upper = $lower = $1; }else{ warn "invalid format of part: '$part'\n"; next; } # process $lower and $upper } -- __END__ Just my 0.00000002 million dollars worth, --- Shawn "For the things we have to learn before we can do them, we learn by doing them." Aristotle * Perl tutorials at http://perlmonks.org/?node=Tutorials * A searchable perldoc is at http://perldoc.perl.org/ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>