Regex 升华SQL正则表达式高亮显示
我正试图在sublime中修改现有的语言定义 它是用于SQL的 当前,Regex 升华SQL正则表达式高亮显示,regex,sublimetext,Regex,Sublimetext,我正试图在sublime中修改现有的语言定义 它是用于SQL的 当前,(\@|@)(\w)*用于匹配本地声明的参数(例如@MyParam)以及系统参数(例如@@Identity或@@FETCH\u STATUS) 我试着把它们分成两组 系统参数可以像(\@@)(\w)*一样获取,但我在本地参数方面遇到了问题 (\@)(\w)*同时匹配@MyParam和@Identity (^\@)(\w)*仅突出显示第一个匹配项(即@MyParam,而不是@MyParam2) 有人能帮我找到正确的正则表达式
(\@|@)(\w)*
用于匹配本地声明的参数(例如@MyParam
)以及系统参数(例如@@Identity
或@@FETCH\u STATUS
)
我试着把它们分成两组
系统参数可以像(\@@)(\w)*
一样获取,但我在本地参数方面遇到了问题
同时匹配@MyParam和@Identity(\@)(\w)*
仅突出显示第一个匹配项(即@MyParam,而不是@MyParam2)(^\@)(\w)*
有人能帮我找到正确的正则表达式吗?试试下面的正则表达式,将本地参数和系统参数分为两组
(?<=^| )(@\w*)(?= |$)|(?<=^| )(@@\w*)(?= |$)
@单面体转义或不转义不会影响这种情况下的结果。我在演示中看到了它的工作原理,但它看起来不像SublimateText允许向后看
(?m)(?:^| )\K(@\w*)(?= |$)|(?:^| )\K(@@\w*)(?= |$)
(?m) set flags for this block (with ^ and $
matching start and end of line) (case-
sensitive) (with . not matching \n)
(matching whitespace and # normally)
(?: group, but do not capture:
^ the beginning of a "line"
| OR
' '
) end of grouping
\K '\K' (resets the starting point of the
reported match)
( group and capture to \1:
@ '@'
\w* word characters (a-z, A-Z, 0-9, _) (0 or
more times)
) end of \1
(?= look ahead to see if there is:
' '
| OR
$ before an optional \n, and the end of a
"line"
) end of look-ahead
| OR
(?: group, but do not capture:
^ the beginning of a "line"
| OR
' '
) end of grouping
\K '\K' (resets the starting point of the
reported match)
( group and capture to \2:
@@ '@@'
\w* word characters (a-z, A-Z, 0-9, _) (0 or
more times)
) end of \2
(?= look ahead to see if there is:
' '
| OR
$ before an optional \n, and the end of a
"line"