Say I have a regular expression like the fowllowing:
{“(group 1) | (group 2) (group 3) |….( group n)”}
to match an input String object, if it matches successfully, how can I know which group among above n groups is acturally matches this String object?
What I am using is regex lib in java.util.
Thank you guys.
Say I have a regular expression like the fowllowing: {(group 1) | (group 2)
Share
Here’s a way:
output: