I have a text that could possibly include words, numbers etc. All I want is to match the numbers inside brackets, but withtout matching them like this:
Lorem 43 ipsum dolor 1 sit amet (355) some
other text.
I want to match the number 355, but since there are numbers without brackets, I get to this:
\(\b\d+\b\) - 1st variant
\(.+?\) - 2nd variant
Presumably I get (355), but my php script is already under heavy load, matching to remove the brackets is not a an option.
Just match like your 1st variant, but capture only the digits in a group, like this
And I think PHP supports named capture groups, so you could name it, so you aren’t looking it up by index, like this I think