Problem with regular expression

Hi i have this function:

fun checkForInvalidOperatorSequence(replacedInput: String): Boolean { val regex1 = Regex("\*+") val regex2 = Regex("\/+") if (regex1.matches(replacedInput) || regex2.matches(replacedInput)) { println("Invalid expression") return true } return false } 

and if call it with something like “2*******2” regex don’t match. I tried to debug regex on Regex101 but it seems ok. Do you have any idea whats is wrong ?

submitted by /u/brut4r
[link] [comments]