You want a regular expression that matches all & lt; img & gt; tags and a regular expression that matches all & lt; img & gt; tags, in addition, the SRC attribute in this tag cannot contain the word logo, and the word does not match. Thank you. ------ Solution ------------------ PHPcode & lt; pre & gt; & lt ;? Php $ string & quot; adsfasdfa & lt; I wants a regular expression that matches all tags
If you want a regular expression that matches all tags, and the SRC attribute in the Tag cannot contain the word logo, the word does not match.
Thank you.
------ Solution --------------------
PHP code
------ Solution --------------------
(?! -Characters after negative pre-check
.*? Greedy match all data before logo
(?!. *? Logo)-indicates matching all logos not included
. *> It is matched before all line breaks>-this is not used here .*? Greedy mainly to avoid the occurrence of> characters in the middle of alt = "abc>"
However, there will be a special case above.
For example
Alt prompt containing logo
Custom attributes
If you consider these situations, you can refine the regular expression to the src position.
------ Solution --------------------
Discussion
(?! -Characters after negative pre-check
.*? Greedy match all data before logo
(?!. *? Logo)-indicates matching all logos not included
. *> It is matched before all line breaks>-this is not used here .*? Greedy mainly to avoid the occurrence of> characters in the middle of alt = "abc>"
However, there will be a special case above.
For example
Alt prompt containing logo
Custom attributes
If you consider these situations, you can refine the regular expression to the src position.