Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #26835
| From | Thomas 'PointedEars' Lahn <PointedEars@web.de> |
|---|---|
| Newsgroups | comp.lang.javascript |
| Subject | Re: Can RegExp() do this?? |
| Date | 2015-02-10 17:04 +0100 |
| Organization | PointedEars Software (PES) |
| Message-ID | <4359125.6fUziKdlIv@PointedEars.de> (permalink) |
| References | <a81c57d8-c415-41dd-87b6-bd19b5697590@googlegroups.com> <5013331.C6z0DViB7m@PointedEars.de> <mbasd3$t2t$1@speranza.aioe.org> |
Joao Rodrigues wrote: > Thomas 'PointedEars' Lahn wrote: >> You can use String.prototype.replace() passing a reference to a RegExp >> instance with alternation and global flag set while giving precedence to >> the alternatives that match substrings that you wish to ignore, and a >> reference to a Function instance for replacer function. Then return from >> that function the match for them, and the highlighted match for the rest. > ^^^^^ ^^^^^ >> That said, at your current position in the learning curve you should not >> attempt to parse provably non-regular languages like HTML using regular > ^^^^^ > > The OP doesn't seem to want parsing the HTML document here. For what they want they need to be able to tell apart matches within “script” elements and “meta-element islands” (as they call it; the resulting markup is probably invalid) from the other matches that they are interested in. That means parsing HTML (I did not say they would need to parse the entire document). Are you confusing parsing with rendering? HTH -- PointedEars FAQ: <http://PointedEars.de/faq> | SVN: <http://PointedEars.de/wsvn/> Twitter: @PointedEars2 | ES Matrix: <http://PointedEars.de/es-matrix> Please do not cc me. / Bitte keine Kopien per E-Mail.
Back to comp.lang.javascript | Previous | Next — Previous in thread | Find similar | Unroll thread
Can RegExp() do this?? dean@hannotte.com - 2015-02-08 05:57 -0800
Re: Can RegExp() do this?? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-02-08 15:17 +0100
Re: Can RegExp() do this?? Joao Rodrigues <groups_jr-1@yahoo.com.br> - 2015-02-09 15:56 -0200
Re: Can RegExp() do this?? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-02-10 17:04 +0100
csiph-web