title: regex to match strings not preceded by a bang
body: <p>In bash, I am trying to match valid attributes that are present in an array. Attributes may be 'disabled' by preceding them with a bang (exclamation mark, !), in which case they must not be matched. I have this:</p>
  
  <pre><code>[[ ${TESTS[@]} =~ [^\!]match ]]
  </code></pre>
  
  <p>which will return true if the word 'match' is in TESTS and not preceded by a !.</p>
  
  <p>It works, except when the word match is in the first position in the array. The problem is the regexp is saying <em>'match preceded by something that isn't a !'</em>. When it's the first item it is preceded by nothing and therefore does not match. </p>
  
  <p>How do I modify the above to say <em>'match not preceded by !'</em> ?</p>
  
  <p>From reading answers to other questions I have tried <em>(?&lt;!!)match</em> but this does not work.</p>