Reputation: 444
This is a regex that matches everything i want to exclude, which is words like abba, trillion etc.
[a-z]*([a-z])([a-z])\2\1[a-z]*
Is there something like [^] which i can use in this situation?
Upvotes: 1
Views: 264
Reputation: 626845
You can use
\b(?![a-z]*([a-z])([a-z])\2\1[a-z]*\b)[a-z]+\b
See regex demo (I think you need a case-insensitive modifier with this regex.)
Since you want to match words only, you need to use \b
word boundary, and to exclude specific words, you need to use a negative lookahead anchored to the leading word boundary.
Upvotes: 1