1200字范文,内容丰富有趣,写作的好帮手!
1200字范文 > 正则表达式语法规则收集

正则表达式语法规则收集

时间:2023-02-20 12:55:47

相关推荐

正则表达式语法规则收集

turnmissile 的 Blog /turnmissile/

Microsoft已经把正则表达式的规则收录在了msdn里面了,有兴趣的朋友可以自己去研究一下(ms-help://MS.MSDNQTR.OCT.1033/cpgenref/html/cpconRegularExpressionsLanguageElements.htm),这里罗列一些我找到的语法元素功能表,大家自己研究吧!

转意字符表

NoteThe escaped character/bis a special case. In a regular expression,/bdenotes a word boundary (between/wand/Wcharacters) except within a[]character class, where/brefers to the backspace character. In a replacement pattern,/balways denotes a backspace.

字符集

A character class is a set of characters that will find a match if any one of the characters included in the set matches. The following table summarizes character matching syntax.

You can find the Unicode category a character belongs to with the method

正则表达式选项

andECMAScriptare not allowed inline.

Atomic Zero-Width Assertions

数量

组构造

Grouping constructs allow you to capture groups of subexpressions and to increase the efficiency of regular expressions with noncapturing lookahead and lookbehind modifiers. The following table describes the Regular Expression Grouping Constructs.

Named captures are numbered sequentially, based on the left-to-right order of the opening parenthesis (like unnamed captures), but numbering of named captures starts after all unnamed captures have been counted. For instance, the pattern((?<One>abc)/d+)?(?<Two>xyz)(.*)produces the following capturing groups by number and name. (The first capture (number 0) always refers to the entire pattern).

Backreference Constructs

The following table lists optional parameters that add backreference modifiers to a regular expression.

Note the ambiguity between octal escape codes and /numberbackreferences that use the same notation. See Backreferences for details on how the regular expression engine resolves the ambiguity.

其他

The following table lists subexpressions that modify a regular expression.

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。