正则表达式:匹配文本前面没有任何数量的空格

Regex: match text not preceeded by any number of spaces

我正在尝试匹配一个函数调用,我们称它为foo.bar。我希望能够避免在包含我已注释掉的函数调用的行上进行匹配。这是 PL/SQL,因此注释用“--”表示。注释文本和函数调用之间可以有任意数量的空格。我已经尝试过负面观察((?!<-- +)(?!<--) +),但它们仍然与注释行匹配。有什么建议吗?

回顾 cannot have a variable length:

[...] The regular expression engine needs to be able to figure out how many characters to step back before checking the lookbehind. When evaluating the lookbehind, the regex engine determines the length of the regex inside the lookbehind, steps back that many characters in the subject string, and then applies the regex inside the lookbehind from left to right just as it would with a normal regex.

因此,您可以使用的另一种策略是匹配整行,禁止在此匹配中注释,并将函数名称与捕获组匹配。给出这个问题的具体答案可能需要更多的上下文。