3 回答
TA贡献2080条经验 获得超4个赞
尽管我在评论中说了什么。我找到了一种解决方法:
(?(?=\([^()\w]*[\w.]+[^()\w]*\))\([^()\w]*([\w.]+)[^()\w]*\)|.)(?=[^{]*\})|(?<!\()(\b\w+\b)(?!\()|ok
解释:
(? # If
(?=\([^()\w]*[\w.]+[^()\w]*\)) # There is (anything except [()\w] zero or more times, followed by [\w.] one or more times, followed by anything except [()\w] zero or more times)
\([^()\w]*([\w.]+)[^()\w]*\) # Then match it, and put [\w.] in a group
| # else
. # advance with one character
) # End if
(?=[^{]*\}) # Look ahead if there is anything except { zero or more times followed by }
| # Or
(?<!\()(\b\w+\b)(?!\() # Match a word not enclosed between parenthesis
| # Or
ok # Match ok
添加回答
举报