This article is mainly on the JS regular test,match,exec was introduced, the need for friends can come to the reference, I hope to help you.
Regular expression GI I can not understand the beginning, I found it from the Internet, and now I share it with you. The following are expressions:/pattern/flags (/mode/tag) constructor function methods are used as follows: New REGEXP ("pattern" [, "Fla GS "] is the new REGEXP (" mode "[," tag "]) Parameter: pattern (mode) represents the literal flags (tokens) of regular expressions If this is specified, flags can be one of the lower denominations: G:global match (full set matching) I:ignore C ASE (ignores case) Gi:both the global match and ignore case (matching all possible values, also ignoring casing) expressions to establish the same regular expression such as: /AB+C/GI Regular expression/i,/g,/ig, Difference and meaning of/gi,/m I (ignore case)/g (all matching characters that appear in Full-text lookup)/m (multiline lookup)/gi (Full-text lookup, ignore case)/ig (full-text lookup, ignore case) Test,match,exec Regular expressions are often used in JavaScript, while regular expressions often use the two functions of match and test, and of course exec. Here's a code example to differentiate between them. Match Example code as follows: var str = "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ"; var regexp =/[a-e]/gi; var rs = Str.match (regexp); //rs= Array (' A ', ' B ', ' C ', ' D ', ' e ', ' A ', ' B ', ' C ', ' d ', ' e '); Test Example code as follows: var str = "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ"; var regexp =/[a-e]/gi; var rs = regexp.test (str); //rs = true; Boolean EXC Example code is as follows: var str = "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ"; var regexp =/[a-e]/gi; var rs; while (rs = regexp.exec (str))!= null) { document.write (RS); document.write (Regexp.lastindex) ; document.write ("<br/>"); }