I use a regular expression to match words (and not match embedded strings) that looks looks like this:
word.trim().matches("(\\w+)(\\.|\\?|\\!|\\<)?");
This works great if the word is a string like this word = " blue ";
But it fails if the word has an embedded &, or any special character, like this
word = " A&P ";
or this
word = " A-P ";
How can I alter my regular expression so that it picks up certain special characters like "&" and "-"