in reply to Re: Re: split on spaces, except those within quotes?
in thread split on spaces, except those within quotes?

I assume you're referring to this:

s/(('|").*?\2)/ ($£ = $1) =~ s!\s+!\cA!g; $£ /ge; #!"

That isn't re-entrant. The right side of a substitution counts as a string (which in this case, is eval'ed because of the /e,); only the right side counts as a regex.

Replies are listed 'Best First'.
Re: Re: Re: Re: split on spaces, except those within quotes?
by diotalevi (Canon) on Nov 12, 2002 at 04:49 UTC

    I'm being imprecise. I wasn't sure if it's just the difference between a self-modifying regex, a regex that modifies source data (and then calls itself), or regexes that just include other regexes. On further consideration I'm sure that it makes a difference I was using the (??{})/(?{}) constructs. Perhaps it's that sort of use that got me into hot water.

    Update: it was just some toy code that did something about defining a qr// regex in terms of a source string, modified the source string and then had the qr// regex call itself again with the new data.

    Update again: My misunderstanding was on whether more than one instance of the regex engine could be active at once. Perhaps it was the regex compilation that killed it. Anyhow I'll just do a bug report now that I know it's not a Just-Don't-Do-That sort of thing.

    __SIG__ use B; printf "You are here %08x\n", unpack "L!", unpack "P4", pack "L!", B::svref_2object(sub{})->OUTSIDE;