title: using extended regular expressions in sed
body: <p>I'm trying to do some crazy regular expressions in sed but am not allowed to</p>
  
  <p>Am I just not getting regular expressions or are regular expressions different in sed</p>
  
  <p>The file I"m working with is like</p>
  
  <pre><code>46,uie,ieo
  39,ieu,tii
  44-46,yut,til
  45,dkd,ytu
  65,dkd,ytu
  40-45,dkd,ytu
  </code></pre>
  
  <p>When I do </p>
  
  <pre><code>cat text.txt | sed s/^4[0-9],//g
  </code></pre>
  
  <p>I almost get what I want, I get</p>
  
  <pre><code>uie,ieo
  39,ieu,tii
  44-46,yut,til
  dkd,ytu
  65,dkd,ytu
  40-45,dkd,ytu
  </code></pre>
  
  <p>But I want to get rid of the of one's that are like 40-45 and 44-46
  So I've tried</p>
  
  <pre><code>cat text.txt | sed s/^4[0-9](-4[0-9])?,//g 
  -bash: syntax error near unexpected token `('
  </code></pre>
  
  <p>And when I try</p>
  
  <pre><code>cat text.txt | sed s/^4[0-9]-?4?[0-9]?,//g
  </code></pre>
  
  <p>I just get</p>
  
  <pre><code>46,uie,ieo
  39,ieu,tii
  44-46,yut,til
  45,dkd,ytu
  65,dkd,ytu
  40-45,dkd,ytu
  </code></pre>
  
  <p>So nothing is filtered</p>
  
  <p>Thank-you!</p>