I am trying to replace an exact match of a word in a string using scala
"\\bhello\\b".r.replaceAllIn("hello I am helloclass with hello.method","xxx")
output >> xxx I am helloclass with xxx.method
what I want is to replace if the word is exactly hello not hello in helloclass and hello.method
xxx I am helloclass with hello.method
and if the input strings are
"hello.method in helloclass says hello"
"hello.method says hello from helloclass"
"hello.method in helloclass says Hello and hello"
output should be
"hello.method in helloclass says xxx"
"hello.method says xxx from helloclass"
"hello.method in helloclass says Hello and xxx"
How can I do that?