RegEx letter but not part of a word


#1

I’ve the below code that is answering the where are you regex, this could be w r u and so.

I I entered how r u, the regex will understand it as w r u, which is not correct in real, how to fix it?

val regEx = """((where|were|w)\s*(are|r)\s*(you|u)(?-i))""".toRegex()

fun main(args: Array<String>) {
    
    val matchResult = regEx.find("how r u")
    println("Hello, world!: ${matchResult?.value.orEmpty()}")
}

#2

Use matchEntire instead of find