This should turn out to be a fairly simple Regex, but I’m no expert in it. I am trying to match a sequence of specific letters, but I do not want them to match if its part of a whole word. I need to only capture the STA letters. Here’s an example:
My Regex: [Ss][Tt][Aa]
STA -- Should Match
sta -- Should Match
Start -- Should NOT match
sta rt -- Should Match
rt sta -- Should Match
rtsta -- Should NOT Match
Can someone help me out here please? This is C# .NET Regex, if it matters.
Use word boundary
\bmarkers to match only whole words: