Octavian Rasnita wrote at Thu, 05 Sep 2002 20:09:58 +0200:

> I want to split a string but it is a little too complicated for me.
> If it is too complicated, don't give me an answer but just a little hint to
> the right direction.
> 
> I have a string like the following example (used to search in a search
> engine):
> 
> "perl editor" free "blind accessible"
> 
> I would like to split this string in such a way, so I would have 3 strings:
> 
> perl editor
> free
> blind accessible
> 
> In the string I could have no sub strings included in "" or more than 2 like
> in my example.

my $string = q{"perl editor" free "blind accessible"};
print join "\n", grep defined, ($string =~ /"(.*?)"|(\w+)/g);

[untested as it isn't a CGI question :-)]

Greetings,
Janek


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to