Help for this page

Select Code to Download


  1. or download this
    # You need to match a double quoted string with the following regex
    # [^"\\]*(\\.[^"\\]*)*",?
    ...
    # ,
    #
    # this must be repeated with m/.../g
    
  2. or download this
    @fields = ();
    while ($text =~ m/"([^"\\]*(\\.[^"\\]*)*)",?|([^,]+),?|,/g {
    ...
    push (@fields, undef) if $text =~ m/,$/; # Account for the special cas
    +e of an empty last field.
    
    # all data is now in @fields