有人能解释一下这个命名组regex吗?
在Sublime文本包(在ST中实现OSX内置拼写检查器的包)中,存在一个选项,用于根据语法定义应检查的文本。 以下是设置文件中的说明:有人能解释一下这个命名组regex吗?,regex,Regex,在Sublime文本包(在ST中实现OSX内置拼写检查器的包)中,存在一个选项,用于根据语法定义应检查的文本。 以下是设置文件中的说明: //可以选择定义正则表达式来设置拼写应该在其中进行的范围 //检查一下。正则表达式应该定义一个名为“checktext”的命名组,该组 //包将用于提取要检查的文本。例如,一个用于跳过 //LaTeX文档中的前言可能如下所示: //(?s)(?这可能会帮助您开始 请注意,这些是非常通用的正则表达式 ## Regex 1 ------------------
//可以选择定义正则表达式来设置拼写应该在其中进行的范围
//检查一下。正则表达式应该定义一个名为“checktext”的命名组,该组
//包将用于提取要检查的文本。例如,一个用于跳过
//LaTeX文档中的前言可能如下所示:
//(?s)(?这可能会帮助您开始
请注意,这些是非常通用的正则表达式
## Regex 1 ---------------------------
(?s) # Dot-All modifier (means dot . matches all chars, including newlines)
(?<= # Lookbehind assertion
\\ begin # Literal escape + 'begin'
\{ document \} # Literal '{' + 'document' + '}'
)
(?P<checktext> # (1 start), Python style named capture group
.* # Greedy dot, match as many char's possible until end of string
) # (1 end)
## Regex 2 ---------------------------
( # (1 start), Open TAG
\< \w+ \> # Literal '<' + many words + '>'
) # (1 end)
(?P<checktext> # (2 start), Python style named capture group
.* # Greedy dot, match as many non-newline char's possible until end of line or string
) # (2 end)
( # (3 start), Close TAG
\< / \w+ \> # Literal '<' + '/' + many words + '>'
) # (3 end)
##正则表达式1---------------------------
(?s)#点所有修饰符(表示点匹配所有字符,包括换行符)
(?#文字“
)#(三完)