/regexp?/ on HTML, but not in form

Posted by takeshin on Stack Overflow See other posts from Stack Overflow or by takeshin
Published on 2010-06-17T18:57:08Z Indexed on 2010/06/17 19:03 UTC
Read the original article Hit count: 348

Filed under:
|
|
|
|

I need to do some regex replacement on HTML input, but I need to exclude some parts from filtering by other regexp.

(e.g. remove all <a> tags with specific href="example.com…, except the ones that are inside the <form> tag)

Is there any smart regex technique for this? Or do I have to find all forms using $regex1, then split the input to the smaller chunks, excluding the matched text blocks, and then run the $regex2 on all the chunks?

© Stack Overflow or respective owner

Related posts about php

Related posts about html