Help for this page

Select Code to Download


  1. or download this
    $line =~ s/\([^)]+\)//g;
    my @results = split /,/, $line;
    
    print "$_: $results[$_]\n" for 0 .. $#results;
    
  2. or download this
    $string = "abc,def;ghi";
    $string =~ /^([^,]+),([^;]+);(.+)$/;
    
  3. or download this
    # Capture a 'non-comma/non-open-paren' string, optionally
    # followed by parens (not captured), optionally followed by a comma
    ...
    my @out = $line =~ /^$re$/;
    
    print "$_: $out[$_]\n" for 0 .. $#out;