I am trying to make a RegEx in Java and test a word to see if it contain some characters like a-z or A-Z or 0-9 or "$" or "_" without the rest of the possible characters including the space.
I tried with :
boolean test = Pattern.matches("[a-zA-Z||[_]||[$]]",wordTest);
or
boolean test = Pattern.matches("[a-z]|[A-Z]|\\*|_+",wordTest);
so some word like : "&_bird" , "bi_r&"
but not " bird" , "b ird^(" for exemple.
It’s been few hours that I am looking for a solution on the web but I didn’t find anything.
boolean test = Pattern.matches("[a-zA-Z0-9_$]+", wordTest);