title: Using sed to remove all console.log from javascript file
body: <p>I'm trying to remove all my <code>console.log</code>, <code>console.dir</code> etc. from my JS file before minifying it with YUI (<strong>on osx</strong>).</p>
  
  <p>The regex I got for the console statements looks like this:</p>
  
  <pre><code>console.(log|debug|info|warn|error|assert|dir|dirxml|trace|group|groupEnd|time|timeEnd|profile|profileEnd|count)\((.*)\);?
  </code></pre>
  
  <p>and it works if I test it with the <a href="http://gskinner.com/RegExr/" rel="noreferrer">RegExr</a>.
  But it won't work with <code>sed</code>.</p>
  
  <p>What do I have to change to get this working?</p>
  
  <pre><code>sed 's/___???___//g' &lt;$RESULT &gt;$RESULT_STRIPPED
  </code></pre>
  
  <p><br/>
  <strong>update</strong>  </p>
  
  <p>After getting the first answer I tried</p>
  
  <pre><code>sed 's/console.log(.*)\;//g' &lt;test.js &gt;result.js
  </code></pre>
  
  <p>and this works, but when I add an OR</p>
  
  <pre><code>sed 's/console.\(log\|dir\)(.*)\;//g' &lt;test.js &gt;result.js
  </code></pre>
  
  <p>it doesn't replace the "logs":<br/></p>
  
  <p><img src="https://i.stack.imgur.com/FzmBD.png" alt="terminal screenshot"></p>