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

This looks way cool. However, it is not coming through in the web browser as something usable. It has odd characters, A with symbols over top in several places, and what looks like a currency symbol in a couple of places. Does anybody have access to the original correct formula?
  • Comment on Re^2: split on spaces, except those within quotes?

Replies are listed 'Best First'.
Re^3: split on spaces, except those within quotes?
by haukex (Archbishop) on Feb 04, 2021 at 13:42 UTC

    I believe that line is supposed to be s/(('|").*?\2)/ ($£ = $1) =~ s!\s+!\cA!g; $£ /ge;. AFAICT, the nonstandard is just supposed to be a scratch variable, so you can replace it with e.g. $a (assuming there's no sort in the call stack) or a lexical of your choosing.

    However, note BrowserUk's words: "I probably deserve hate mail for this one but..." - see e.g. Regexp::Common::delimited or Text::Balanced.