<p>I've created the following regex pattern in an attempt to match a string 6 characters in length ending in either "PRI" or "SEC", unless the string = "SIGSEC". For example, I want to match ABCPRI, XYZPRI, ABCSEC and XYZSEC, but not SIGSEC.</p>

<pre><code>(\w{3}PRI$|[^SIG].*SEC$)
</code></pre>

<p>It is very close and sort of works (if I pass in "SINSEC", it returns a partial match on "NSEC"), but I don't have a good feeling about it in its current form. Also, I may have a need to add more exclusions besides "SIG" later and realize that this probably won't scale too well. Any ideas?</p>

<p>BTW, I'm using System.Text.RegularExpressions.Regex.Match() in C#</p>

<p>Thanks,
Rich</p>

Assuming your regex engine supports negative lookaheads, try this:
```
```
((?!SIGSEC)\w{3}(?:SEC|PRI))
```
```
Edit: A commenter pointed out that .NET does support negative lookaheads, so this should work fine (thanks, Charlie).