title: How do I match part of a string only if it is not preceded by certain characters?
body: <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>