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


in reply to How to replace in one regexp

#$path =~ s{\?.*$}{}; #$path =~ s{[^/]+$}{}; $path =~ s{[^/\?]*(\?.*)?$}{};