java.util.regex.PatternSyntaxException: Unmatched closing ')' : during string.split operation -
i trying perform split similar following:
string str = "({somestring 1 lot of braces , commas}),({somestring 12with lot of braces , commas})"; println str.split("}),({");
but see:
java.util.regex.patternsyntaxexception: unmatched closing ')' near index 0 }),({
clearly , string being treated regular expression.
is there way can escape string?
the character (
, )
, {
, }
special character in regexp. have escape these:
println str.split("\\}\\),\\(\\{");
Comments
Post a Comment