I am trying to use regex to detect when a user enters something like "Bob & Jane" or "Bob and Jane".
I have tried the following and all of them are trigged when something like "andy" or "andrew" are entered:
/^[a-zA-Z]( & | and )[a-zA-Z]$/
/(" "and" "|" "&" ")/
/( and | & )/
(I tried all these with and without the '^'
and '$'
)
Thank you in Advanced for you thoughts!
and\b
to match the word and when the character after it causes a word boundary. – scragar Jun 19 '14 at 15:27