title: How to write a regex to match a string that has the word 'error' but not 'info'?
body: <p>I have two strings <code>a</code> and <code>b</code> here:</p>
  
  <pre><code>irb(main):022:0&gt; a
  =&gt; "[:error] [pid 10101:tid 139953357145856] 2015-03-15 20:33:44,848 pid  10101 tid 139953357145856 INFO     env      Using"
  
  irb(main):023:0&gt; b
  =&gt; "[:error] [pid 10101:tid 139953357145856] 2015-03-15 20:33:45,712 pid  10101 tid 139953357145856 ERROR     env      Using"
  </code></pre>
  
  <p>I want to write a regex that can ignore <code>a</code> and match <code>b</code>. </p>
  
  <p>In string <code>a</code>, ':error' is followed by 'INFO'. </p>
  
  <p>In the second string <code>b</code>, ':error' is followed by 'ERROR'</p>
  
  <p>I have tried this </p>
  
  <pre><code>a.match(".*error.*(?!INFO).*")  
  </code></pre>
  
  <p>But the regex will return match for both <code>a</code> and <code>b</code></p>
  
  <p>The use of <code>match</code> is a must because I am trying to pass the regex to a sensu script (<a href="https://github.com/sensu/sensu-community-plugins/blob/master/plugins/logging/check-log.rb#L189" rel="nofollow">https://github.com/sensu/sensu-community-plugins/blob/master/plugins/logging/check-log.rb#L189</a>)</p>