
I'm trying to match strings of the form "a&b&c&d" with the following expression: "(?:([^&]+)&)*([^&]+)". This nicely matches the whole string but instead of giving me the submatches "a", "b", "c" and "d" I just get "c" and "d". Could anyone tell me what I'm doing wrong?
Look more closely at your expression: it has only *two* marked sub-expressions, $1 gets "overwritten" each time it matches. - John Maddock http://ourworld.compuserve.com/homepages/john_maddock/

--- In Boost-Users@y..., John Maddock
I'm trying to match strings of the form "a&b&c&d" with the
following
expression: "(?:([^&]+)&)*([^&]+)". This nicely matches the whole string but instead of giving me the submatches "a", "b", "c" and "d" I just get "c" and "d". Could anyone tell me what I'm doing wrong?
Look more closely at your expression: it has only *two* marked sub-expressions, $1 gets "overwritten" each time it matches.
Thanks for the answer. Seems like I have to revise my understandig of sub-expressions a litte. :-) Markus
participants (2)
-
John Maddock
-
markus_schoepflin