fork(12) download
  1. #!/usr/bin/perl
  2. $regex = '(?:\([^\)]*\)|"[^"]*")(*SKIP)(*F)|\s*,\s*';
  3. $subject = '(Date, Notional), "Date, Notional", "(Date, Notional)"';
  4. @splits = split($regex, $subject);
  5. print "\n*** Splits ***\n";
  6. foreach(@splits) { print "$_\n"; }
  7.  
Success #stdin #stdout 0s 3608KB
stdin
Standard input is empty
stdout
*** Splits ***
(Date, Notional)
"Date, Notional"
"(Date, Notional)"