Add another question.
(. +), (.) +, And. + are not the same?
[Ctrl + A select all Note: If you need to introduce external Js, You need to refresh it to execute]
Why are the running results of the above code different?
Some results are separated by commas. Why?Copy codeThe Code is as follows: exec () returns an array that matches the content that matches the pattern (composed of the entire array and the Child parts that are arranged in a forward order). When displayed with alert, the array toSting () is displayed () result (a string separated by commas ).
In the regular expression. (point) represents any character except the line break (when the m parameter is added to enable multi-line match mode, it represents any character), with the escape symbol \. indicates the point character ontology.
Copy codeThe Code is as follows: var Pattern3 =/<(.) +>/I;
Alert(Pattern3.exe c ("<p align = center onclick = dsa>") [1])
Why do we get a instead of p?
Test alert(pattern3.exe c ("<p align = center onclick = dsa6>") [1]). 6
(.) + Match all the way and return the result in the final match.
+ (Plus sign) indicates the plus pattern (or pattern fragment). If there are at least one, there may be multiple.
The content enclosed by () in the regular expression is considered as a child part of the pattern and will be reflected in exec.