I have a String
man loves mango. heman is a hero.
now I want to get the word man
but it's selecting man, mango, heman
how do I make sure that the word man
is only selected?
the regex I'm using [^(.*?)]\s(man)
(It's wrong)
I have a String
man loves mango. heman is a hero.
now I want to get the word man
but it's selecting man, mango, heman
how do I make sure that the word man
is only selected?
the regex I'm using [^(.*?)]\s(man)
(It's wrong)
Use a word boundary
\bman\b
This matches exactly the word man
.