First affixed two addresses, regular expression builder, and the third is the regular expression generated graphic resolution, and test the correctness of
1,http://www.bejson.com/othertools/regex_create/
2,http://tool.oschina.net/regex/#
A constructor
var reg = new RegExp('\\bis\\b');
Second, the character class, with [] Building a simple class
'a1b3c4d7'.replace([\[abc]\g], 'P');
Output: 'P1P3P4d7'
Negated character class
'a1b3c4d7'.replace([\[^abc]\g], 'P');
Output: 'aPbPcPPP'
Third, the scope of the class [az]
Fourth, the predefined classes
V. border
eg: word boundary
'this is a boy'.replace(\bis\is, Q)
Output: 'this Q boy'
Sixth, quantifiers
Seven, greedy
Eight groups
(boy){3}=> boy boy boy
boy{3} => boyyy
eg: a packet of concepts 2015-12-23 12/23/2015 transformed into
‘2015-12-23’.replace(/(\d{4})-(\d{2})-(\d{2})/g, '$2$3$1')
Output: 12-23-2015
Nine, forward-looking
eg: word character is behind the data, only replaced the previous letter
Forward Prospects
Negative Preview
Ten, exce, match, splice usage function