Код: Выделить всё
String expression = "$+!*'(),{}|\^[]`#%";/?:&=";
< /code>
Это мой код < /p>
public static boolean hasBlackListCharacters(CharSequence strString)
{
boolean hasBlackListedChar = false;
String expression = "$+!*'(),{}|\^[]`#%";/?:&=";
Pattern pattern = Pattern.compile(expression, Pattern.CASE_INSENSITIVE);
Matcher matcher = pattern.matcher(strString);
if (matcher.matches()) {
hasBlackListedChar = true;
}
return hasBlackListedChar;
}
< /code>
Ввод не должен соответствовать ни одного из следующих символов. < /p>
$+!*'(),{}|\^[]`#%";/?:&=
< /code>
Входная строка < /p>
Подробнее здесь: https://stackoverflow.com/questions/393 ... va-pattern