I have this regex, which works as on this link: https://regex101.com/r/HVKfYU/1
This is my regex string: (\d+[-–]\(?\d+([+\-*/^]\d+ ?[+\-*/^] ?\d+)?\)?)
These are my test strings:
(0–(2^63 - 1))
(1-(2^16 - 2))
(1-29999984)
(3-32)
This is what the regex matches in the first two cases:
0–(2^63 - 1)
1-(2^16 - 2)
// works, it doesn't match the first pair of brackets
And this is what it matches in the last two:
1-29999984)
3-32)
// doesn't work, it matches the closing bracket
I'd like it to not match the last closing bracket in any of the test strings. At the moment I'm stripping the bracket if necessary, but I would like to avoid that. How could I modify the regex, so it works as I would like?