Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #26820
| Path | csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!feeder1.news.weretis.net!news.solani.org!.POSTED!not-for-mail |
|---|---|
| From | Thomas 'PointedEars' Lahn <PointedEars@web.de> |
| Newsgroups | comp.lang.javascript |
| Subject | Re: Can RegExp() do this?? |
| Date | Sun, 08 Feb 2015 15:17:27 +0100 |
| Organization | PointedEars Software (PES) |
| Lines | 34 |
| Message-ID | <5013331.C6z0DViB7m@PointedEars.de> (permalink) |
| References | <a81c57d8-c415-41dd-87b6-bd19b5697590@googlegroups.com> |
| Reply-To | Thomas 'PointedEars' Lahn <cljs@PointedEars.de> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset="ISO-8859-1" |
| Content-Transfer-Encoding | 7Bit |
| X-Trace | solani.org 1423405093 10020 eJwVycEBwCAIA8CVUEio4xQl+49Q+72Dc3BnEAwIMifynfbjONIq+M3nrkV5pKN7NXOHqqAP/ewQfw== (8 Feb 2015 14:18:13 GMT) |
| X-Complaints-To | abuse@news.solani.org |
| NNTP-Posting-Date | Sun, 8 Feb 2015 14:18:13 +0000 (UTC) |
| User-Agent | KNode/4.14.2 |
| X-User-ID | eJwNx8EBwEAEBMCWXMKinGPpv4RkfmMvDtoVBrW1RdiforjcXpHETWEraw/nVPLxcg7dL9vGO7VjpDkYBD9mdxbD |
| Cancel-Lock | sha1:5y41rfGZAoK00Jz/FjmVDbLNv+w= |
| X-NNTP-Posting-Host | eJwNxsERACEIA8CWQEzClcOI9F+Ct69F0Hm0CW4MJs2zsuyvrb4u3v5UE2ax1IcOB1ZKohXwAA66EBE= |
| Xref | csiph.com comp.lang.javascript:26820 |
Show key headers only | View raw
dean@hannotte.com wrote:
^^^^^^^^^^^^^^^^^
Your real name belongs there.
> How can I highlight all cases of "this", for example, without
> unintentionally highlighting cases of "this" that occur within islands of
> HTML and META-HTML.
Is that a question?
^
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
expressions.
<http://stackoverflow.com/a/1732454/855543>
<http://en.wikipedia.org/wiki/Chomsky_hierarchy>
> IS THIS POSSIBLE?
Yes. Please do not shout. And do not use the borked, spammed, and
troll-infested Google Groups for posting; use a decent newsreader.
--
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 | Next 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