Help for this page

Select Code to Download


  1. or download this
    @parts = split m{
      "            # if we match a quote
      (?{ ++$x })  # increment quote counter
    ...
        (?!)       # fail
      )            # (otherwise succeed)
    }x, q{A B "C D" E F"G H" I};
    
  2. or download this
    @parts = $string =~ m{
      (?=\S)       # so long as there's something ahead of us:
      [^\s"]*      # non-quotes non-whitespace
    ...
        [^\s"]*    # non-quotes non-whitespace
      )*           # zero or more times
    }xg;