my $uripath = 'http://www.somewhere.com/~s/reports/?C=M;O=D'; # easier to maintian as a partial expression # added support for more sortorders # which is probably where you erred my $rx_dirsort = qr{\?(C=[NMSD];O=[AD])$}; print "hit!\n" if $uripath =~ /$rx_dirsort/;
hth
Edit: Actually, the most important error you made was using the final '?', which has been pointed out by many here.
In reply to Re^3: Difficult? regex
by stiller
in thread Difficult? regex
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |