I want to match field[123][33]["code"]
where ["code"]
is optional.
So I made this regex /field\[(\d*)\]\[(\d*)\]((?:\[")(.+)(?:"\]))?/g
that is doing fine.
The problem is that it's coming in 4 groups 123
, 33
, ["code"]
and code
but I only want 3 groups 123
, 33
, code
. Is it possible?
Here is a test example.