I want to write matching expression to read string between parentheses () from a big string. eg: the big string is:-
(something), (something2), (something3)
How can I write matching expression for this to read something, something2, something3 in groups.
You can’t read all those groups in one go but using
Matcher#find()and this expression you might read those:\(([^\(\)]*)\)(reads: match must start with(, must contain any number of characters not being(or)– those form your group – , and must end with)).Note that the escape in the brackets is not necessary, but done for consistency, since they are needed outside.
This prints: