简体   繁体   中英

java.util.regex.PatternSyntaxException: Unclosed character class near index 12 \\b]([^.(|[]+)

Unclosed character class near index 12 \\b]([^.(|[]+) ^

The regex above works fine, however it does not work on java and i cant detect what is the problem that causing it.

Could someone help me?

Thanks in advance

您需要避免像\\b\\\\]\\\\(\\\\[^.(|\\\\[\\\\]+)这样的开括号和闭括号\\b\\\\]\\\\(\\\\[^.(|\\\\[\\\\]+)我相信这只是您剩余的正则表达式,而不是整个正则表达式),因为您指定了方括号内的元字符,在定义正则表达式时具有特殊含义。

To make the regex working in Java use: \\b\\]([^.(|\\[]+)

The Java Regex String is:

"\\b\\]([^.(|\\[]+)"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM