title: What is the difference between sed and awk regular expression
body: <p>I have one awk and one sed example. Both seems to be using the same regular expression, but the output differs. So the pattern expansion must be getting different. But i can not get the difference. Can anyone explain?</p>
  
  <pre><code> $ echo "THE BEAR ATE THE FISH" |sed -e 's/[^ ]*(H|F)[^ ]*/&lt;red&gt;&amp;/g'
  THE BEAR ATE THE FISH
   $ echo "THE BEAR ATE THE FISH" | awk 'gsub(/[^ ]*(H|F)[^ ]*/,"&lt;red&gt;&amp;")'
  &lt;red&gt;THE BEAR ATE &lt;red&gt;THE &lt;red&gt;FISH
   $ sed --version
  GNU sed version 4.1.5
   $ awk --version
  GNU Awk 3.1.5
  </code></pre>