java - Check that the input only contains certain characters -


i need check input string contains alphabetic characters, asterisks, spaces, , tabs.

i tried this, doesn't work:

firststr.matches(".*[a-za-z].*.*[\\t].*.*[\\s].*")  

use regex check if string contains alphabets, spaces, asterisks, tabs:

firststr.matches("[a-za-z *\t]+") 

you close, needed single character class.


Comments

Popular posts from this blog

javascript - Bootstrap Popover: iOS Safari strange behaviour -

Magento/PHP - Get phones on all members in a customer group -

session - Logging Out Using PHP -