Tag Archives: regex

Regex validation for removing invalid characters in Android.

This is a simple example in Android to allow only valid characters to enter in a textBox or EditText. I am using this regex pattern to allow only valid characters. “^[a-z_A-Z0-9 ]*$”; This expression allows only characters from a-z, A-Z and numbers from 0-9 and a ‘ ‘(space) character. Here is the java code Main.xml Strings.xml