I am trying to check if a string has all the forbidden characters like "/#$%^&" ... i tried to find a solution but couldn't find anything , i just want to check if all characters in the string match regex pattern \w
string.all seems perfect but i cant add regex pattern to it here is what i am trying to do:
// "abce#ios" must return false because it contains #
// "abcdefg123" must return true
fun checkForChars(string :String) :Boolean {
val pattern = "\\w".toRegex()
return (string.contains(regex = pattern))
}
thanks in advance