Hey all, so I\'m trying to allow some text input which goes through a regex check before it\'s sent off. I want the text to only include A-Z, 0-9, and the space \" \" charac
\s allows for any ASCII whitespace character. Consider using that rather than " ".
\s
if(!title.matches("[a-zA-Z0-9_\s]+")) { //fail } else { //success }
You're not including the space in the Regex. Try the following:
if (!title.matches("[a-zA-Z0-9 ]+"))