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

Here's a fancy regex for Kanji :)

Note that I have 2 different versions available below; one that takes into account backslashed quotes within quotes, and another that doesn't.

# Use this one if you'd like to account for backslashed quotes my @matches = $string =~ / ((?: (?: ' (?: (?>[^\\']*) | \\ . ) ' ) | \\ . | [^\s'\\]* )+) /gx; # This one does not take backslashed quotes into account #/ #((?: # ' [^']* ' # | [^\s']* #)+) #/gx; # because of the [^\s']*, you'll have matches weaved into your data '' @matches = grep{$_}@matches;

Update: Fixed paste error.