As part of my validation I have the following regex expression:
^
# Prevent 3+ consecutive letters: 'wheee'
(?!\w*([a-zA-Z])\g{-1}{2,})
[a-zA-Z](?:[a-zA-Z]|'(?!')){0,}
# Words or '&' are space or hyphen separated
(?:
[ -]
# Prevent 3+ consecutive letters: 'wheee' (for rest of words)
(?!\w*([a-zA-Z])\g{-1}{2,})
(?:[a-zA-Z]|'(?!')){1,}
|
[ -]
&
)*$
I was wondering the effectiveness of the expression and/or possible pitfalls?