Hi and thank you. It works!
Could you explain me please in a few words what is this line doing exactly?
I want to learn.

print join "\n", grep defined, ($string =~ /"(.*?)"|(\w+)/g);

I don't understand starting from defined, ...

Thank you again.

It is CGI related because I want to use it in a search engine.
I would like to test some more things, like if the + or - sign is placed
before a word, but for the moment it is enough to test if the quotes are
used.


Teddy,
My dear email address is [EMAIL PROTECTED]

----- Original Message -----
From: "Janek Schleicher" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, September 06, 2002 2:54 PM
Subject: Re: Splitting a string


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]





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

Reply via email to