title: using regular expressions to highlight links in a text
body: <p>hi i am trying to highlight links in a text using RegEx ,For this I tried with match() method and replace() method,
    but i didn't get it.plz any one can help me.</p>
  
  <p></p>
  
  <pre><code>&lt;head runat="server"&gt;
      &lt;title&gt;&lt;/title&gt;
                 &lt;script type="text/javascript" &gt;
  
          function findReplace() {
              var srcString = document.getElementById('new').innerHTML;
              var pattern = new RegExp("&lt;[^&lt;]+&lt;/a&gt;", 'ig');
              var newString = srcString.match(pattern);
              for (var i = 0; i &lt; newString.length; i++) {
                var replaced = srcString.replace(pattern, '&lt;div style="background-color: yellow; display: inline; font-weight: bold;"&gt; ' + newString[i] + ' &lt;/div&gt;')
  
              document.getElementById('new').innerHTML = replaced
  
          }
      &lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;form id="form1" runat="server"&gt;
      &lt;input type='button'  id='btn'value='Match' onclick="findReplace()"  /&gt;
      &lt;div id='new'&gt;
      Finally we  have succeeded! &lt;a href='#'&gt;Remember&lt;/a&gt; that if you just want to replace one word,
       you should use a string or normal regular expression as your searchFor parameter. However, 
       if you want to replace &lt;a href='#'&gt;google&lt;/a&gt; be sure to write a &lt;a href='#'&gt;regularexpression&lt;/a&gt; and append a little g at the end!
       &lt;/div&gt;
      &lt;/form&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>