I'm trying to count occurences of a word in a message.
I've got this line of code :
var nbOccurences = Regex.Matches(haystack, needle, RegexOptions.CultureInvariant | RegexOptions.IgnoreCase).Count;
Which works perfectly fine for e.g. "bob" in the message "my name is bob".
But (as the message can be in french), I'd like to be able to find "chene", "chène", "chêne"... when looking for "chene". Right now, words with accents don't come up as results.
I thought that adding RegexOptions.CultureInvariant would help, but it doesn't seem like it.
Any help would be appreciated.