While try to split the value by using "[" OR "]" then we are getting the above issue.
Ex : String str="Selenium []"
str.split("[")
we are getting the below exception.
Exception :
java.util.regex.PatternSyntaxException: Unclosed character class near index 0
Solution
The Special character "[" and "]" used in Regular Experssions, so these characters are not standared characters.
So we should add excape character for use this special character ("\[" and "\]"). But the escape character "\" is not allowed for "[" and "]".
So we should use string as "\\[" or "\\]"
Exact code will be
Ex : String str="Selenium []"
str.split("\\[")
http://stackoverflow.com/questions/21816788/unclosed-character-class-error
Ex : String str="Selenium []"
str.split("[")
we are getting the below exception.
Exception :
java.util.regex.PatternSyntaxException: Unclosed character class near index 0
Solution
The Special character "[" and "]" used in Regular Experssions, so these characters are not standared characters.
So we should add excape character for use this special character ("\[" and "\]"). But the escape character "\" is not allowed for "[" and "]".
So we should use string as "\\[" or "\\]"
Exact code will be
Ex : String str="Selenium []"
str.split("\\[")
http://stackoverflow.com/questions/21816788/unclosed-character-class-error