Regular expression memory overflow problem

problem description

regular expression memory overflow, JVM can"t check memory, accumulate all the time, and then the program hangs

the environmental background of the problems and what methods you have tried

delete the second set of parentheses and you"ll be fine. Speechless
this code is used to match the following letters
AB ABABABA ABABABA ABABABA
. The first two letters are a group, the middle is a group, and the last is a set of
. However, using the following code, the program runs and memory accumulates all the time. no, no, no.

related codes

/ / Please paste the code text below (do not replace the code with pictures)
"^ ([Amurz] {2})\ s ((\ w {7}\ s) *) (\ w {7}) $"
matcher.group (1)
matcher.group (2)
matcher.group (4)
delete the second set of parentheses from the regular expression. Speechless

what result do you expect? What is the error message actually seen?

Menu