Path: csiph.com!usenet.pasdenom.info!dedibox.gegeweb.org!gegeweb.eu!nntpfeed.proxad.net!proxad.net!feeder2-2.proxad.net!newsfeed.arcor.de!newsspool4.arcor-online.net!news.arcor.de.POSTED!not-for-mail Content-Type: text/plain; charset="UTF-8" Message-ID: <9161127.hJ6kbhveRM@PointedEars.de> From: Thomas 'PointedEars' Lahn Reply-To: Thomas 'PointedEars' Lahn Organization: PointedEars Software (PES) Date: Sun, 07 Jul 2013 22:18:30 +0200 User-Agent: KNode/4.10.4 Content-Transfer-Encoding: 8Bit X-Face: %i>XG-yXR'\"2P/C_aO%~;2o~?g0pPKmbOw^=NT`tprDEf++D.m7"}HW6.#=U:?2GGctkL,f89@H46O$ASoW&?s}.k+&. MIME-Version: 1.0 Lines: 63 NNTP-Posting-Date: 07 Jul 2013 22:18:32 CEST NNTP-Posting-Host: 1cba3a7d.newsspool4.arcor-online.net X-Trace: DXC=j@:9m>CR6]:RLigj];iP=84IUK X-Complaints-To: usenet-abuse@arcor.de Xref: csiph.com comp.lang.javascript:20581 dann90038@gmail.com wrote: > To JJ > it works for me in js if I use > \.feed(burner|sportal)\.com\/|feed.*\.gif($|\?)* Which is nonsense. Neither can the end of input/line be repeated, nor is the “?” allowed to be repeated (unescaped) in a “http(s):”-URI-Reference. > and I get matches on all 3 with the string > http://feeds.feedburner.com/any > http://feed.thesite.com/any/blah.gif > http://feedsite.com/any/blah.gif?var=blah And you also get a match for http://feedsite.com/any/blah.gif??????????var=blah which certainly is _not_ a valid “http(s):”-URI-Reference. > it also works with > \.feed(burner|sportal)\.com\/|feed.*\.gif($|\?) > if my string alone is > http://feed.thesite.com/any/blah.gif > > so, I'd think there's something after the ".gif" which isn't $ end of > input or "?" character RFC 3986, Appendix B, contains a *proper* regular expression for matching URIs that can be adapted to result in /\.feed(burner|sportal)\.com\/|feed[^?]*\.gif(\?[^#]*)?(#.*)?$/ or (non-greedy matching, probably not worth the incompatiblity here) /\.feed(burner|sportal)\.com\/|feed[^?]*\.gif(\?.*?)?(#.+)?$/ It is possible that this is still not what the OP needs as then there can only be query-part and fragment-part if a resource name was specified (“/a| b(c?)/” ≡ “/(?:a)|(?:b(c?))/”). A more viable solution might be /(\.feed(burner|sportal)\.com\/|feed[^?]*\.gif)(\?[^#]*)?(#.*)?$/ ^ ^ or /(\.feed(burner|sportal)\.com\/|feed[^?]*\.gif)(\?.*?)?(#.+)?$/ ^ ^ Note the extra parentheses that group the outer alternation. Also, where non-greedy matching is supported, potentially more efficient non-capturing parentheses are supported, for example: /(?:\.feed(?:burner|sportal)\.com\/|feed[^?]*\.gif)(\?.*?)?(#.+)?$/ -- PointedEars Twitter: @PointedEars2 Please do not Cc: me. / Bitte keine Kopien per E-Mail.