Regular thinking is the same, but the specific wording will be different, the/g,/i,/m mentioned here in other places may not be used.
One, JS regular sign/g,/i,/m description
1,/g indicates that the expression will be used to find all possible matches in the input string, and the result can be multiple. If you do not add/g, you will only match one
2,/i indicates matching is case-insensitive
3,/m represents multiple lines matching, what is multiple line matching? is a potential match that matches the ends of the line break. Influence of ^$ symbols in regular
Second, the example illustrates
The use of 1,/g
<script type= "Text/javascript" >
str = "Tankzhang (231144)" +
"Tank Ying (155445)";
res = Str.match (/tank/); No plus/g.
Alert (res); Show a tank
res = Str.match (/tank/g); Added/g.
Alert (res); Show as Tank,tank
<strong></script></strong>
The use of 2,/i
<script type= "Text/javascript" >
str = "Tankzhang (231144)" +
"Tank Ying (155445)";
res = Str.match (/zhang/);
Alert (res); Display as null
res = Str.match (/zhang/i); Plus/I
Alert (res); Show as Zhang
</script>
The use of 3,/m
<script type= "Text/javascript" >
var p =/$/mg;
var s = ' 1\n2\n3\n4\n5\n6 ';
Alert (P.test (s)); Display as True
Alert (RegExp.rightContext.replace (/\x0a/g, ' \\a ')); Show \a2\a3\a4\a5\a6
alert (Regexp.leftcontext); 2345 shown as Vertical
alert (Regexp.rightcontext); Displayed as 6
var p =/$/g;
var s = ' 1\n2\n3\n4\n5\n6 ';
Alert (P.test (s)); Display as True
Alert (RegExp.rightContext.replace (/\x0a/g, ' \\a ')); Don't show anything.
alert (Regexp.leftcontext); 123456 shown as Vertical
alert (Regexp.rightcontext); Don't show anything.
var p =/^/mg;
var s = ' 1\n2\n3\n4\n5\n6 ';
Alert (P.test (s)); Display as True
Alert (RegExp.rightContext.replace (/\x0a/g, ' \\a ')); Show as 1\a2\a3\a4\a5\a6
alert (Regexp.leftcontext); 12345 shown as Vertical
alert (Regexp.rightcontext); Displayed as 6
</script>
From the example above, we can see that the ^$ segmentation method affected by/M
The three examples mentioned above,/i,/g,/m separately, can be used to arrange combinations. Personally, I don't think it's much use