Web site for testing:
Http://www.pagecolumn.com/tool/regtest.htm
the string used for testing is:
Bsdfefsdf
Aaa
Dfsdfa
AAA G: Global lookup Mode
No g will only match 1, plus g to find all the matches
Regular expression:
/aaa/
The results match the following:
Bsdfefsdf
Aaa
Dfsdfa
Aaa
Regular expression:
/aaa/g
The result matches the following:
Bsdfefsdf
Aaa
Dfsdfa
Aaa
I: Do not distinguish between sizes
Regular expression:
/aaa/i
The result matches the following:
Bsdfefsdf
Aaa
Dfsdfa
Aaa
m: Multi-line Lookup mode
The default ^ and $ match only the beginning and end of the string, such as:
Regular expression:
/^aaa/
will not match the test string, because the test data 4 lines as a whole, the beginning is BSD rather than AAA
Regular expressions
The results match the following:
Bsdfefsdf
Aaa
Dfsdfa
Aaa
With the M argument, ^ and $ can match the beginning and end of each row, but only the first one, such as:
The results match the following:
Bsdfefsdf
Aaa
Dfsdfa
Aaa