in reply to Re: Highlighting a text inside another one.
in thread Highlighting a text inside another one.
The huge gnarly regex option is attractive because the engine does most of the work and yes, if I could do it it would be, uh, cool.
but won't it be bloody slow?
The alternative I'm contemplating is to just run loads of regexes to wrap tags round every word on my "wish list", so that I get Bill >> <subvert pos="6">Bill</subvert>
I'm already having to use a lookahead & lookbehind to avoid matching html attributes, so I just add something that ignores anything inside subvert tags, and finally turn all the subvert tags into spans.
Sure, this could be done with one regex but I suspect (complete airy hypothesis) that it will be slower.
of course, the thing to do is to do it both ways.
|
|---|