1

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

1
  • 1
    You need to escape the opening bracket in your character class Commented Jan 11, 2015 at 18:20

2 Answers 2

1

You need to escape opening and closing square bracket like \b\\]\\(\\[^.(|\\[\\]+) (this is just your remaining regex and not whole regex i believe) since you specify meta character within square brackets and has a special meaning while defining regex.

Sign up to request clarification or add additional context in comments.

Comments

0

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

The Java Regex String is:

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

1 Comment

I have remove the ^ at the end, since it is most likely part of the exception output which points out the position with problem, not part of the original regex.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.