Regular Expressions are powerful.
The regular expressions in each language are similar. Learn one, and others are quick to learn,
JS Regular Expression highlights blog:
1 JavaScript Regexp Object Reference Manual W3C http://www.w3school.com.cn/js/jsref_obj_regexp.asp
2 JavaScript http://www.yaosansi.com/post/745.html using regular expressions
Regular Expression http://www.iteye.com/topic/30728 of 3 JS
4 JavaScript classic Regular Expression http://www.dedecms.com/html/xitongyanshi/20070423/38637.html
5 warm New Javascript Regular Expression http://www.cnblogs.com/libinqq/archive/2008/07/31/1257699.html
Advanced JS replacement function
Simply replace the string, for example
Note that num = 2, num = 3, num = 1. How do we replace the number following num =?
VaR RegEx =/\ ] + num = (\ D) [^>] * \/\>/g; // extract . The write is complicated. You can extract the numbers after num =.
VaR result = "";
VaR DATA = "the above string ";
VaR I = 1;
Result = data. Replace (RegEx, function (smatch) {// smatch is the one extracted each time
Return smatch. Replace (/num = \ D/, "num =" + I ++ );
});
Alert (result );