(I) predefined classes
Example : ab & matching a numeric string + + any character: ab & \ D.
(Ii) border
Regular expressions are used to match the character of the border
⑴ Example 1 : The first one is I did not write a word boundary
The second effect is to add character boundaries
The third is to replace this is a 0, no word boundaries in front of, behind example of the boundaries.
⑵ Example 2 : common boundary character "^" and "$" Examples of the basic meaning
Observe both the writing position.
⑶ Example 3 Example border character "^" and "$" and modifiers of "m":
(Iii) quantifier
Example :
㈣js regular greedy
⑴ greedy: allow regular expression matching as much as possible, until the match fails
⑵ example :
㈤js regular non-greedy mode
⑴ non-greedy mode: Let the match the regular expression as little as possible, meaning that if successful will not continue to try to match
How to make ⑵ use non-greedy regular expression pattern instead of the default greedy mode?
It's very easy after the quantifier with "?" Button.
⑶ example :
(Vi) grouping
Use ⑴ () functional grouping can be achieved, so that the packet quantifiers . Such as: (Byron). 3} {
Example : This is a comparison of the two examples, the second packet using
⑵ or
Use "|" can achieve or effect
Example :
⑶ Backreferences
Example 1 :
Example 2 : Example for year month day packet capture
⑷ ignored grouping
Do not want to capture some packets, only you need to add in the grouping ":?" Can
Example : (:? Byron) (the ok).
㈦前瞻
⑴正则表达式从文本头部向尾部开始解析,文本尾部方向,称为“前”。
⑵前瞻就是在正则表达式匹配到规则的时候,向前检查是否符合判断,后顾/后瞻方向相反。
⑶JavaScript不支持后顾。
⑷符合和不符合特定断言称为肯定/正向匹配和否定/负向匹配。
⑸前瞻语法:
⑹示例: