Luke Palmer wrote at Thu, 29 Aug 2002 15:21:57 +0200: >> The ° character doesn't have any special meaning, >> that's why I choosed it in the above example. >> However, it also symbolizes a little capturing >> and as it isn't filled, >> it could really symbolize an uncapturing. > > Interesting idea. I'm not sure if I agree with it yet. However, I don't > agree with your syntax, as I can't type that character.
Year, that's of course a problem. But I don't have any imagination what over typeable character with no other meaning could be choosen. > Is it possible to > modify what was captured? > > /" ([ \\ . { chop; chop } | <[^\\]> ]*?) "/ > > Or is that just too ugly? IMHO, that looks as ugly as the other workaround solutions :-) I think, the greatest strength of Perl is that it expresses simple things in a simple, short and natural way. Such a regexp behaviour would simplify a lot of jobs where we have to make workarounds instead about the simple stuff "Match it, capture the relevant parts and ignore some irrelevant subparts". It's always possible to implemented with - more captures, joined together later or - a substitution regexp/translitariton for the captured part to remove the irrelevant subparts It's from my IMHO comparable to problem "Group it, but don't capture it" what had been solved with the (?:....) sytnax. >From that regarding, a (?_...) (Questionmark underscore) syntax could also be an idea with the meaning "Group it, don't capture it even not in surrounding captures". With it, the OP problem would look like: /\s*((?_").*?"(?_°)|\S+)/; (I choosed the underscore, as it is typeable and could have the mnemonic meaning of some underlying unimport background group) But perhaps, I'm only dreaming .... Cheerio, Janek