How would I go about replacing a word(s) that's not in an HTML tag? I still want to leave remaining the HTML intact, just replace word(s) that are not in HTML tags. Anybody? Thanks guys.
Not sure that I get your question. Could you clarify what you mean by HTML tag? Give an HTML example of what you would want the script to keep versus what you would want the script to remove.
Sure, for example if I wanted to replace the words - how, go, still, replace, href, strong - in the following block:
----------
<STRONG>How</STRONG> would I go about replacing a word(s) that's not in an HTML tag? <EM>I still want to leave </EM>remaining the HTML intact, just <a HREF="
word(s)</a> that are not in HTML tags. Anybody? Thanks guys.
----------
This is what would happen to the words(All case insensitive):
How - the first instance would not get replaced because it has the HTML tag <STRONG> around it.
go - the first instance of it would get replaced because there's no surrounding HTML tags around it, and the "go" in "google" would not get replaced because it is part of an html tag.
still wouldn't get replaced because it's around <EM>
replace - would not get replaced because it's around the HREF tag
STRONG - would NOT replace the "STRONG" in the HTML tag
href - would not replace href if it's part of an html tag
This is pretty much what I'm looking for. I've tried a few regular expressions to replace words not in an html tag, but I'm having a hard time. I appreciate any feedback. Thanks!
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.