title: Javascript regex replace not working ie
body: <p>I am doing some logic to a string and everything workes fine in Firefox. Found error in IE but confused to fix it.</p>
  
  <pre><code>var txt=[], regg=/&lt;\/?[^&gt;]+&gt;/gi, ost=str.replace(regg,'').substr(0,l), g=j=0;
  var match = null;
  while(match = regg.exec( str )){
      var f = (regg.lastIndex-match.index);
      txt.push([match[0], match.index, regg.lastIndex, f]);
  }
  </code></pre>
  
  <p>In the above code if I call <code>regg.exec( str )</code> before while then then working in IE. But don't understand why to call.</p>
  
  <p>Also observed that <code>ost=str.replace(regg,'').substr(0,l)</code> is not accepting for IE.</p>
  
  <p>Guys, Please help.</p>
  
  <p>Thanks in advance.</p>