-2

I need to write a regex that matches the word versus, verse, vs., v., v but v should not be jumbled in words.

@"\b((.*?)" + Regex.Unescape(xz) + @"[.,:/s]?)\b", RegexOptions.IgnoreCase))

Here I'll pass the array and test it.

Biffen
  • 6,249
  • 6
  • 28
  • 36

1 Answers1

1

This will get you close:

\b(?:(?:vers(?:e|us)|v)\b|vs\.|v\.)

One difficulty is in word boundaries vs. (heh) words that end in a period. See Regex using word boundary but word ends with a . (period) for other options.

Note that "verse" can also mean "poetry" so there could be false positives.

Community
  • 1
  • 1
TrueWill
  • 25,132
  • 10
  • 101
  • 150