January 28th, 2009, 03:23 AM
PHP-Programs - Regular expression help
I'm trying to create an html file comparison script using PEAR Text_Diff. One problem I got is when changing an image.
For example, here
<del>.....</del> - deleted patterns
<ins><b>Stains</b></ins> and dirt must be <del>removed</del>
immediately. A hot water rug <img <del>src='rat.jpg'</del><ins>src='fox.jpg'</ins> /> cleaner
<ins>......</ins> - inserted patterns
But when we are changing something inside tag (in between < and >), it's getting messed up. For example, if I'm changing src of the img tag, the result will be <img <del>src='rat.jpg'</del><ins>src='fox.jpg'</ins> />
So what I'm looking for a function to pass my string and
if there is any <del> or <ins> found after '<' and before '>' of a tag, the <ins> or <del> should move to before '<'
if there is any </del> or </ins> found after '<' and before '>' of a tag, the </ins> or </del> should move to before '>'