It should be to solve the problem of matching all characters including newlines.
. === [^rn]
(dot, decimal point) matches any single character, except carriage return r line feed n characters: n r u2028 or u2029.
In the character set, dot ( . ) loses its special meaning and matches a literal dot ( . ).
It should be noted that the m multiline flag does not change the behavior of the period. So to match a character set across multiple lines, use [^] > (of course you don't intend to use it in older versions of IE), which will match any character, including newlines.
For example, /.y/ matches "my" and "ay" in "yes make my day", but not "yes".
>> var s = 'Please yes make my day!';
>> s.match(/yes.*day/);
Array [ "yesmake my day" ]
// 因为[^...]代表匹配除过...代表的字符以外的所有字符,所以当然换行符也可以匹配了。
Here is a series of explanations on regular expression related syntax. Regular expression front-end user manual | louis blog Here is the directory structure:
It should be to solve the problem of matching all characters including newlines.
Here is a series of explanations on regular expression related syntax. Regular expression front-end user manual | louis blog
Here is the directory structure: