Fro*_*ost 7 java regex unicode character-properties
我想匹配包含某个单词的所有字符串.喜欢:
String regex = (?:\P{L}|\W|^)(???)(?:\b|$)
Run Code Online (Sandbox Code Playgroud)
但是,Pattern类不会编译它:
java.util.regex.PatternSyntaxException: Unmatched closing ')' near index 39
(?:\P{L}|\W|^)((?:??|??|??)(?:?)|?)|?)?)(?:\b|$)
Run Code Online (Sandbox Code Playgroud)
我已经设置了unicode_case来编译param,不知道这里出了什么问题
final Pattern pattern = Pattern.compile(regex, Pattern.CASE_INSENSITIVE | Pattern.UNICODE_CASE| Pattern.CANON_EQ);
Run Code Online (Sandbox Code Playgroud)
感谢帮助!:)
(?:\\P{L}|\\W|^)((?:\xe3\x83\x99\xe3\x82\xb9|\xe3\x83\x99\xe3\x82\xb9|\xe3\x83\x98\xe3\x82\xba)(?:\xe3\x83\x91)|\xe3\x83\x91)|\xe3\x83\x8f)\xe3\x82\x9a)(?:\\b|$)\n( )(( )( ) ) ) )( )\nRun Code Online (Sandbox Code Playgroud)\n\n错误消息中的模式有两个额外的“)”
\n