Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #20582
| From | Denis McMahon <denismfmcmahon@gmail.com> |
|---|---|
| Newsgroups | comp.lang.javascript |
| Subject | Re: Regexp confusion |
| Date | 2013-07-07 20:28 +0000 |
| Organization | A noiseless patient Spider |
| Message-ID | <krcj27$p4d$1@dont-email.me> (permalink) |
| References | <sh5vv3omcuc2$.1ls4uvq7bzu5d$.dlg@40tude.net> |
On Mon, 08 Jul 2013 00:26:11 +0700, JJ wrote: > I'm trying to filter out URLs that match below conditions using regexp. The text you've shown and the words you've used do not agree completely, but I've tried to resolve them as best I can. > * Contains ".feedburner.com" or ".feedportal.com". e.g.: > http://feeds.feedburner.com/any http://feedportal.com/any ^.*feed(burner|portal)\.com.*$ > * Starts with "feed" and ends with ".gif". > http://feed.thesite.com/any/blah.gif ^(http:\/\/)?feed.*\.gif$ > * Starts with "feed" and the following characters contains ".gif?". > http://feedsite.com/any/blah.gif?var=blah ^(http:\/\/)?feed.*\.gif.*$ My first attempt at combining these would be: /^(http:\/\/)?.*feed((burner|portal)\.com|.*\.gif).*$/ Tested here: http://www.sined.co.uk/tmp/regexjj.htm There may be some potential there for false positives, which might be improved by checking for a word boundary before the f of feed, and after \.com and \.gif However, I suspect that even so there may be potential false positives, for example any gif image on feedtheworld.com. -- Denis McMahon, denismfmcmahon@gmail.com
Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Regexp confusion JJ <duh@nah.meh> - 2013-07-08 00:26 +0700
Re: Regexp confusion dann90038@gmail.com - 2013-07-07 12:21 -0700
Re: Regexp confusion Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-07-07 22:18 +0200
Re: Regexp confusion Denis McMahon <denismfmcmahon@gmail.com> - 2013-07-07 20:28 +0000
Re: Regexp confusion JJ <duh@nah.meh> - 2013-07-08 08:24 +0700
Re: Regexp confusion Andreas Bergmaier <andber93@web.de> - 2013-07-08 17:51 +0200
Re: Regexp confusion JJ <duh@nah.meh> - 2013-07-09 03:58 +0700
csiph-web