If you make the last parenthesized match non-greedy by removing the trailing question mark, you can leave out the final $.
I recommend using a line like the following to show what you've captured, just in case you have whitespace: print "1: ->$1<-\n2: ->$2<-\n3: ->$3<-\n";
In reply to Re: Regexp oddity
by chromatic
in thread Regexp oddity
by daemon23
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |