2

I have a question about Matcher. If there are two capturing group that can be satisfied, which one will it choose? Let's say the pattern is (A|AB|B), if matcher is input with "AB", will it satisfy the A group then the B group or the AB group?

2
  • Did you try this example?. It should be simple enough to test. Commented Feb 5, 2015 at 13:23
  • It matches the first, not the longest. See: stackoverflow.com/questions/4515309/… Commented Feb 5, 2015 at 13:24

0

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.