I need some help with regular expressions: I'm trying to check if a sentence contains a specific word.
let's take for example the title of this topic:
"Regex to find a specific word in a string"
I need to find if it contains the word if, which in this case it's false.
I can't use the method contains because it would return true in this case (spec*if*ic)
I was thinking about using the method matches but I'm kinda noob with regular expressions.
Basically the regex in input to the matched method needs to specify that the character right before the word I'm looking for and right after the word is not alphabetic (so it couldn't be contained in that word) or that the word is at the beginning or at the end of the sentence
thanks a lot!