Re: [NH] find/replace in tags
- Don Strack (donstrack@...) wrote (in part) (on 2008-10-06 at
> Whatever I try, it either finds nothing, or selects everything betweenDon: In case you are still struggling after Rudolf's and Marcello's posts?
> the first <td> and the last </td>
Sounds like you might be getting bitten by regex "greedy" mode.
Though I'm not sure how it would get from first to last unless the html
code is all in one line. You can control whether a . (dot) can span more
than one line by putting either (?s) -span multiple lines or (?-s)
-span ONLY one line at the beginning of your regular expression. If
neither is specified, (?-s) is implied. So:
o will find from the first <td> to the LAST </td> in the
entire file (greedy mode)
o will find from the first <td> to the NEXT </td> even if its
on the next or following lines. (non-greedy mode)
Your original question was:
> How do I strip the "class" contents of any and all tags, as below:ie. class can appear in other tags than just <td> and (I assume) any
> change this:
> <td class="[whatever]">[whatever]<
> to this:
other attributes are to be left unchanged as is - CORRECT?
I *think* this should work:
^!replace "\bclass=".*?" >> "" rwsai
In English: match from a word boundary (\b) followed by literal class="
to the very next occurrence of quote (.*?") and replace everything
matched by nothing.
If this doesn't work and/or you can't make it work with a tweaking you
can guess at .... Could you take one old file and get it to the state
before you wanted to apply this fix and manually change it to what you
want the result to be and zip the two files together as before.html and
I created a folder in our yahoo-group files:
you can post the zip.
Regards ... Alec (buralex@gmail & WinLiveMess - alec.m.burgess@skype)
[Non-text portions of this message have been removed]