我目前正在使用 oniguruma 正则表达式来搜索类似匹配的功能,但某些关键字除外。例如,在字符串“this is a test() and im() testing() thi[s]() this_[is]_a_fun(with,some,params)”中
正则表达式应该匹配:
test
,
im
,
testing
,
thi[s]
this_[is]_a_fun
我正在使用的当前正则表达式是
\s*([A-z0-9\w_]+).?(?=\()(\b(?<!if|while|for|return|else|elif|equals|or|xor|and|not|le|gre))
但这thi[s]
与单词中包含括号的任何函数不匹配。
我尝试更新正则表达式以将这些模式与正则表达式匹配
\s*([A-z0-9\w_|\[|\]]+).?(?=\()(\b(?<!if|while|for|return|else|elif|equals|or|xor|and|not|le|gre))
但无济于事。
任何匹配这些模式的帮助将不胜感激