# selected results of CrazyInsomniacs Substr impl. # doubles pacining converted to single by me. http://perlmonks.com/index.pl?node_id=68135 looks like the file name is: index.pl?node_id=68135 and the extension is: pl?node_id=68135 We even got a query string, whoa: node_id=68135 so the true filename would be: index.pl? and the true file extension would b: pl http://www.foobar.com/foo/ looks like the file name is: and the extension is: com/foo/ http://www.foobar.com/foo?test looks like the file name is: foo?test and the extension is: com/foo?test We even got a query string, whoa: test so the true filename would be: foo? and the true file extension would b: com/foo http:///file.ext looks like the file name is: file.ext and the extension is: ext #Selected results of CrazyInsomniacs regex implementation #input string added by me http://www.foobar.com (, , ) (http, www.foobar.com/, foo/bar/foobar.html) http://www.foobar.com/foo/bar/foo.bar.html http:///file.ext (, , ) #### # regex snippet for matching # at most two bundled extensions # foobar.gzip -> foobar,.gzip # foobar.tar.gzip -> foobar,.tar.gzip # foo.bar.tar.gzip -> foo.bar,.tar.gzip # the snippt should paste into place over # my earlier matches for filename and extension ( #capture the filename [^./?] # doesnt start with a . or ? or / [^/?]+? # all chars not / or ? , (ctd.) # --leave stuff for rest of rex )? #we dont have to have a filename ( #capture the extension (?: # Group but dont capture \. # they start with dots you know [^?.]* # any letter that arent a . or ? ){0,2} # anywhere from 0 to 2 exts please. ) #thanks.. # regex snippet for matching # filename and all bundled extensions # foobar.gzip -> foobar,.gzip # foobar.tar.gzip -> foobar,.tar.gzip # foo.bar.tar.gzip -> foo,.bar.tar.gzip # the snippt should paste into place over # my earlier matches for filename and extension ( #capture the filename [^./?] # doesnt start with a . or ? or / [^/?.]+? # all chars not / or ? or. # --leave stuff for rest of rex )? #we dont have to have a filename ( #capture the extension \. # they start with dots you know [^?]* # any letter that arent a or ? )? #they are optional you know