CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Regular Expressions:
Regex, HTML string modification

 



anglaissam
Novice

Dec 7, 2009, 8:39 PM

Post #1 of 1 (2199 views)
Regex, HTML string modification Can't Post

I have a regex that is designed to help improve readability for a html document.

Code
"(?=((?!<\/?em).)*<\/em>)

The purpose of this regex is to escape " marks from within <EM> affected sentences. Example:

Before: <P>This "is" <EM>a <STRONG>"Test"</STRONG></EM></P>
After: <P>This "is" <EM>a <STRONG></EM>"<EM>Test</EM>"<EM></STRONG></EM></P>

Note the regex only affects " inside of <EM> elements. My problem is that i need to modify the regex to account for " inside of tags. <EM CLASS="a1"> or <STRONG CLASS="a1"> etc.

With the current regex those " marks will be modified. Any help in stopping that from happening would be appreciated.

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives