Sorry for the badly formatted title, but I don’t know how to explain this question any better. To go with an example: I want to match something using a matching group, but I also want to use groups inside that group because I need them for the matching but I don’t want those inner groups to show up as a result using PHP’s preg_match. Here’s an example of such a query:
(([^0-9^\n]+)*([^0-9^\n^ ]+))
It will match a sentence containing spaces, but without any trailing spaces. As you can see it uses one outter group (which I want as a result) and two groups inside it. Can I substitute those inner groups for something that will do the same job, or somehow tag them as irrelevant as result data?
Thanks
You have to use non-capturing subpatterns:
Applied to your regex, it becomes: