On Tue, Oct 04, 2005 at 12:37:52PM -0400, Ronald J Kimball wrote:
> On Tue, Oct 04, 2005 at 12:28:20PM -0400, Donald Leslie {74279} wrote:
> > I have a string of the form:
> > 'a bc "d e f" h "i j"'  what I want is the quoted items not
> > to split on blanks.
> > [0] = 'a' , [1] = 'bc' , [2] = 'd e f' ... .
> > Is there is simple way to do this ?
> Assuming that the quoted strings do not contain escaped quotes:
> my $string = 'a bc "d e f" h "i j"';
> my @parts = grep defined $_, $string =~ /\"([^"]*)\"|(\S+)/g;

Aaarggghhh!!

Pretend that the text is CSV, it just uses an odd definition of comma.
Then use the fine module.

-- 
David Cantrell | Nth greatest programmer in the world

Are you feeling bored? depressed? slowed down?  Evil Scientists may
be manipulating the speed of light in your vicinity.  Buy our patented
instructional video to find out how, and maybe YOU can stop THEM
 
_______________________________________________
Boston-pm mailing list
[email protected]
http://mail.pm.org/mailman/listinfo/boston-pm

Reply via email to