title: How can I regex match a single character that is not part of a pattern?
body: <p>If I have a string like so:</p>
  
  <p><code>&amp;#263;;
  Joh&amp;#263;; Smith &lt;js@comms.com&gt;;
  ;boom&amp;#703;;woopwoop;
  ;</code></p>
  
  <p>and I wish to match all the semicolons that are not part of that html entity, what regex technique can I use?</p>
  
  <p>I got close a couple of times with a negative look behind and my best attempt so far is the following:</p>
  
  <pre><code>(?&lt;!&amp;#.+?[^;]);
  </code></pre>
  
  <p>However this won't match all the semicolons required to take this victory home.</p>
  
  <p>I'm using php.</p>
  
  <p>I am considering replacing the html entities with a token first, then do the replacement of the semicolons and finally replacing the entities back into the string.</p>
  
  <p>This seems quite clunky and inelegant so I'd rather do it with a regex, even if it gets a little unwieldy.</p>
  
  <p>EDIT: @sln supplied a regex that will select nearly all entities, which as he points out should be the first step when trying to avoid something.</p>
  
  <p><code>(?i)[%&amp;](?:[a-z]+|(?:#(?:[0-9]+|x[0-9a-f]+)));</code></p>
  
  <p>While the question is about how to select single characters except those found in a string, the context of the data I provided makes this a very useful regex to know and to attach to this question.</p>