by JoeCoder_ · 11y ago · 0 comments
"Tarzan"|(Tarzan)
You can also include more than one case of what you don't want to match. This one also finds only the cases of Tarzan that don't match the first three patterns: Tarzania|--Tarzan--|"Tarzan"|(Tarzan)
You can even use more complex regexes. This matches all words not in an image tag: <img[^>]+>|(\w+)
And likewise this matches anything not surrounded by <b> tags: <b>[^<]*</b>|([\w\s]+) <img[^>]+>|(\w+)
...has some bugs. The part on the left mistakenly matches `<imgasvaasdf>` and mistakenly misses `<img>`. Better would be: <img\b.*?>|(\w+)