title: Finding and removing all occurences of shortcode with javascript
body: <p>I have this shortcode for wordpress.</p>
  
  <pre><code>[shortcodename code="dhgsfy87djh" time="2"][/shortcodename]
  </code></pre>
  
  <p>This pattern may appear more than once inside a textarea. I need to remove all occurrences of this pattern in the text area. The problem is - I am not a reg ex person. Kindly suggest a regex in to remove all occurrences of this pattern using javasript.</p>
  
  <p>For example the content may be like this:</p>
  
  <pre><code>[shortcodename code="dhgsfy87djh" time="2"][/shortcodename] [shortcodename code="hdfds8f7684768" time="5"][/shortcodename] blah blah [shortcodename code="df87s8bdf78sd" time="8"][/shortcodename]
  </code></pre>
  
  <p>![This how it is][1]</p>
  
  <p><a href="http://s9.postimg.org/em9myvz1r/snap.png" rel="nofollow">http://s9.postimg.org/em9myvz1r/snap.png</a></p>
  
  <p>Since i really dont know why this question was down voted, i am assuming someone here was einstien and i am definitely not competing.</p>
  
  <p>So please look at the picture again. say this is the wordpress comment box. Now i need only one occurrence of shortcode to be in there.That too in the beginning only.  Say some one copy pastes more of it here and there i want that stripped off. And then i would add only one on the top.</p>
  
  <p>the adding part i am doing, but the stripping i dont know. I used some reg ex but it works in php preg_match however it does not work in javascript.</p>
  
  <p>This is what i used.</p>
  
  <p>/(^[shortcodename[]).([ ]*).(code=\"someprefix_).([A-Za-z0-9]+).([ ]<em>).(time=\"(\d</em>)\"<em>).(]</em>).([/shortcodename])/i;</p>
  
  <p>This is the first question of mine being answered on stackoverflow, so i request everyone for little patience with me. Dont down vote if you dont know the answer, say "i dont know" or "i didnt understand" or "provide more info".</p>
  
  <p>Now please help me with this.</p>