I want to write a simple regular expression to check if in given string exist any special character. My regex works but I don\'t know why it also includes all numbers, so wh
You can use a negative match:
Pattern regex = Pattern.compile("([a-zA-Z0-9])*"); (For zero or more characters)
Pattern regex = Pattern.compile("([a-zA-Z0-9])*");
or
Pattern regex = Pattern.compile("([a-zA-Z0-9])+"); (For one or more characters)
Pattern regex = Pattern.compile("([a-zA-Z0-9])+");