Scriptman Scriptman - 1 year ago 81
PHP Question

preg_match_all except if tag has class

I have a regex which replaces shortcodes in my texts.


<textarea class="ignoreShortCodes">[test_code]</textarea>

Now both
blocks are going to replaced, but I don't want this.

Now here is my regex:


Please note, a shortcode can contain arguments like:

[test_code name="test"]

Who can help me with this issue?

Answer Source

You can use a negative lookahead:


which will match every lignes that doesn't contain the class ignoreShortCodes

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download