C
Chris Mahoney
Hi
I have a string containing a phrase, and I want to search for a
particular word and get its index. I've tried a couple of things
already:
InStr(phrase, word) - this doesn't work because it finds "subwords",
eg. If I search for "colour" in a phrase containing "colourful", it'll
still detect it.
Regex.IsMatch(phrase, "\b" & word & "\b") - this doesn't work because
it only returns True or False, and doesn't actually tell me where in
the phrase the word is.
Basically I seem to be looking for a "hybrid" solution; one that will
find a whole word, and return its index. What should I be doing?
Thanks
Chris
I have a string containing a phrase, and I want to search for a
particular word and get its index. I've tried a couple of things
already:
InStr(phrase, word) - this doesn't work because it finds "subwords",
eg. If I search for "colour" in a phrase containing "colourful", it'll
still detect it.
Regex.IsMatch(phrase, "\b" & word & "\b") - this doesn't work because
it only returns True or False, and doesn't actually tell me where in
the phrase the word is.
Basically I seem to be looking for a "hybrid" solution; one that will
find a whole word, and return its index. What should I be doing?
Thanks
Chris