Re: [PHP] regex : Extracting parts of a string :-???

2001-02-11 Thread Christian Reiniger

On Sunday 11 February 2001 17:21, akio wrote:

> $thestring = "\"Hello everyone\" bye";
>
> What I want to extract is: Hello everyone. Instead  I get: bye.
> I use this command
>
> ereg("([^\"\"]*)$",$thestring,$regs)
>
> and echo $regs[1].
>
> How can I extract what's within double quotes?

Hmm, I only know the preg syntax. With that it's

preg_match ('/"([^"]*?)"/', $thestring, $matches);

$InQuotes = $matches [1];

-- 
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)

"use the source, luke." (obi-wan gnuobi)

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] regex : Extracting parts of a string :-???

2001-02-11 Thread akio

Hello everyone,

 I have a string like

$thestring = "\"Hello everyone\" bye";

What I want to extract is: Hello everyone. Instead  I get: bye.
I use this command

ereg("([^\"\"]*)$",$thestring,$regs)

and echo $regs[1].

How can I extract what's within double quotes?


TIA

Regards



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]