This regexp finds the four groups as expected:
https://regex101.com/r/5dF794/1
Since sometimes the second group is missing, I added the ?
to make it optional, but it never finds the second group:
https://regex101.com/r/0Jbcwy/1
Why is the second group never captured, even when it does exist?
Here are the two patterns and the test text:
^(.).* - (?:(\d+)mm - ).*\(([\d\.]+)\" x ([\d\.]+)\"\)
^(.).* - (?:(\d+)mm - )?.*\(([\d\.]+)\" x ([\d\.]+)\"\)
N251 - 8mm - 4' x 10' (49.21" x 122.05")