in reply to excluding strings in regex
If you specifically want to exclude "housecat" and "polecat" but match "Yucatan" or anything else that has "cat", use a negative lookbehind assertion: /(?<!pole)(?<!house)cat/. (The regex that goes in (?<! ) or (?<= ) must be a fixed width, so "pole" and "house" need separate assertions; however "wild" could be combined with "pole" as /(?<!wild|pole)cat/.
|
|---|