Example 1-Change Date Format:
In the expression, three groups are defined for Month, Date and Year. These groups values are reordered and joined with dash.
Example 2- Change One tag to another tag:
Suppose we have to replace links to their text in a paragraph means
See following code:
var str ='This is <a href=\"http://techbrij.com\">TechBrij</a>, A wonderful collection of resources like <a href="http://www.asp.net">ASP.NET</a> , <a href="http://jquery.com">jQuery</a> blah blah... '; str=str.replace(/(<a href="([^"]+)">([^<]+)<\/a>)/ig,'<span>$3</span>'); alert(str);
This is <span>TechBrij</span>, A wonderful collection of resources like <span>ASP.NET</span> , <span>jQuery</span> blah blah…
Hope, It helps.