Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #27056
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.fsmpi.rwth-aachen.de!newsfeed.straub-nv.de!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail |
|---|---|
| From | Ben Bacarisse <ben.usenet@bsb.me.uk> |
| Newsgroups | comp.lang.javascript |
| Subject | Re: Regular expression |
| Date | Sun, 15 Mar 2015 21:38:18 +0000 |
| Organization | A noiseless patient Spider |
| Lines | 23 |
| Message-ID | <877fuindpx.fsf@bsb.me.uk> (permalink) |
| References | <me4tbi$iiu$1@dont-email.me> |
| Mime-Version | 1.0 |
| Content-Type | text/plain |
| Injection-Info | mx02.eternal-september.org; posting-host="017616aa25f81ec581c44d76d61ba2f3"; logging-data="12086"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18XMxX3nusczDsDRCl/wSbirGaxuPWvzzA=" |
| Cancel-Lock | sha1:M8cWn4YbHJur/BBz5QbGeGSAdBo= sha1:PfgpYsjTiVbRQQFfpWTgqzYkrGk= |
| X-BSB-Auth | 1.29233f72adf323c7374a.20150315213818GMT.877fuindpx.fsf@bsb.me.uk |
| Xref | csiph.com comp.lang.javascript:27056 |
Show key headers only | View raw
"Tony Johansson" <johansson.andersson@telia.com> writes: > Can somebody explain this regular expression <snip> replace(/([bcdfghjklmnpqrstvwxz])o\1/gi, '$1'); Match any one of bcdfghjklmnpqrstvwxz -- that's what the []s mean. I.e. match a single non-vowel (taking y to be a vowel too). Remember this matched letter -- that's what the ()s mean. Match a single 'o'. Match the non-vowel seen before -- that's what the \1 means. Do this globally (i.e. repeat for very match) -- that's the 'g' -- and ignoring case -- that's the 'i'. For every such match, replace it with the single-letter non-vowel. '$1' in a replacement string means the first captured match. -- Ben.
Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Regular expression "Tony Johansson" <johansson.andersson@telia.com> - 2015-03-15 22:25 +0100 Re: Regular expression Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-03-15 21:38 +0000 Re: Regular expression Cezary Tomczyk <cezary.tomczyk@gmail.com> - 2015-03-15 23:40 +0100
csiph-web