Suppose I want to match four-letter words whose first and last letters are not the same. What is a regex that will do this?
For example, I tried this: ^(.)..[^\1]$ but got no results.
Negative lookahead solves your problem.
/^(.)..(?!\1).$/
https://regex101.com/r/MvqXdE/1