in reply to Re^2: Difficult? regex
in thread Difficult? regex

Try:

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.