title: Matching Fields Wrapped in Punctuation but not Single Apostrophe
body: <p>I have the following <code>Regex</code> that I use to translate fields in SQL strings</p>
  
  <pre><code>string posLookBehind = @"(?&lt;=\p{P}*)\b";
  string posLookAhead = @"\b(?=\p{P}*)";
  string keyword = "FieldA";
  string translatedKeyword = "FldA";
  string strSql = "SELECT [FieldA] FROM SomeTableA;";
  strSql = Regex.Replace(
      strSql,
      baseRegexLeft + keyword + baseRegexRight,
      translatedKeyword, 
      RegexOptions.IgnoreCase);
  </code></pre>
  
  <p>For some keyword <code>FieldA</code>, the above regex would replace 'FieldA' with 'FldA' in each of the following: <code>[FieldA]</code>, <code>[FieldA + FieldB]</code> et al. However, I now wish to restrict the regex. <strong>I do not want to match</strong> <code>'FieldA'</code> <strong>note the single apostrophe</strong>. </p>
  
  <p>So, I have changed the regex using regex subtraction to remove <code>'</code> from the punctuation set:</p>
  
  <pre><code>string posLookBehind = @"(?&lt;=[\p{P}-[']]*)\b";
  string posLookAhead = @"\b(?=[\p{P}-[']]*)";
  </code></pre>
  
  <p>where the other code is the same. But this is still matching <code>'FieldA'</code>. <strong>What am I doing wrong here?</strong></p>
  
  <p>Thanks for your time.</p>