Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有这个正则表达式:
"\\(d+)(,)\\(w+)(,)\\(w+)(,)\\(w+)(,)\\(\")(d+)(,)(d+)(.)(d+)(\")(,)\\(w+)(,)\\(w+)(,)\\(w+)";
我收到了这条消息:
索引 3 附近无与伦比的关闭 ')'
有人可以提示我的正则表达式有什么问题吗?
您正在转义第一个括号(因此其含义将是字面意思)但不是下一个,因此它是无效的正则表达式。
"\\(d+)(,) ^ ^ | | --+- // You have escaped this one... | - // ...but not this one.
而不是\\(d+)你可能想要(\\d+)甚至更好\\d+。您收到错误是因为不\\影响。(d
\\(d+)
(\\d+)
\\d+
\\
(
d