我想匹配任何字符(不区分大小写),除非前面是单引号,后跟文本 On Error Goto:
匹配:
on error goto err_handler
if aap = 0 then on error goto Myerrorhandler
on error goto errorhandler1
on error goto errorhandler2
不匹配:
' on error goto errorhandler3
' if aap =0 then on error goto errorhandler4
Any line not containing On Error Goto
我尝试过:[^']*(On Error Goto)
但这不起作用。
测试程序中是否使用Errorhandler
谢谢!
最佳答案
使用
^[^'\n\r]*On Error Goto
使用i
不区分大小写模式和m
多行模式。请参阅proof .
说明
--------------------------------------------------------------------------------
^ the beginning of the string
--------------------------------------------------------------------------------
[^'\n\r]* any character except: ''', '\n' (newline),
'\r' (carriage return) (0 or more times
(matching the most amount possible))
--------------------------------------------------------------------------------
On Error Goto 'On Error Goto'
关于regex - 匹配除 ' 之外的任何字符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64297790/