On Dec 10, 2005, at 22:54, $Bill Luebkert wrote:
$_ = q{"LastName, First Name" <address>, "Name" <address>, <address>;
FirstName LastName, address; "First \"nick\" Last" address};
s/\\"/\003/g; # handle embedded \"
s/"([^"]+)"/\001$1\002/g; # handle open/close "
s/(\001[^\002]*),([^\002]*\002)/$1\004$2/g; # handle commas in quotes
"...,..."
my @f = split /[,;]/;
foreach (@f) {
s/\001|\002/"/g; # restore quotes
s/\003/\\"/g; # restore \"s
s/\004/,/g; # restore embedded ,s
print "\t$_\n";
}
__END__
Pretty ingenious, albeit a bit of cheating, uh? :)
but if all else fails, I'll probably go with that, thanks!
I still wonder if there is a single regexp that could do what I want,
and if so, I'd like to learn about it. I'm just not very familiar with
backtracking and lookaheads...
Thanks,
dZ.
--
Black holes are where God divided by zero.
_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs