I: Indicates case-insensitive when matching
STR = "JavaScript is different from Java";
reg =/java\w*/i;
Arr_m = Str.match (reg);//arr_m = ["JavaScript"]
G: Indicates a global match is performed
STR = "JavaScript is different from Java";
reg =/java\w*/ig;
Arr_m = Str.match (reg);//arr_m = ["JavaScript"]
M: Indicates that matching is performed in multiline mode
In multiline mode,^ represents the beginning of a line or the beginning of a string, whichrepresents the end of a line (newline) or the end of a string
str = "JavaScript is different from Java they is different";
reg =/\w+$/;
Arr_m = Str.match (reg);//arr_m = ["Different"]
str = "JavaScript is different from java\nthey be different";
reg =/\w+$/;
Arr_m = Str.match (reg);//arr_m = ["Different"]
str = "JavaScript is different from java\nthey be different";
reg =/\W+$/MG;
Arr_m = Str.match (reg);//arr_m = ["Java", "different"]
str = "JavaScript is different from Java\njavascript and Java is different.";
REG1 =/(^java\w*) | (Java)/ig;
REG2 =/(^java\w*) | (Java)/img;
ARR_M1 = Str.match (reg);//arr_m1 = ["JavaScript"]
arr_m2 = Str.match (reg);//arr_m2 = ["JavaScript", "Java", "JavaScript"]
JavaScript Regular expression-suffix option (tag)