(?:\/(\w+?=\/)\/(\w+))*
Is there any way to retrieve backreferences from within a group? In my expression above does the no-reference (?:) prevent the entire group from capturing backreferences?
Trying to match for example: /hello/how/are/you.../today and capture all the values between '/'
Is there any way to retrieve backreferences from within a group?
Yes. Groups are not interpreted in a hierarchy. For example (a(b)) has simply two groups, one and two, which can be (back)referenced. In terms of references it is equal to (a)(b). The order of the references is simply determined by the order of the groups (determined by the start of the group) in the regex pattern. The fact that one group is part of another group does not change this fact.
In my expression above does the no-reference (?:) prevent the entire group from capturing backreferences?
No. It only prevents the group marked as a non capture group from capturing (back)references. Nested groups are unaffected and will be captured unless they, too, are marked as non capture groups.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With