Re: extracting quoted text in string
| From: | John W. Holmes | Date: | Tue, 01 Jun 2004 13:08:14 +0000 |
| Subject: | Re: extracting quoted text in string | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-187343@lists.php.net to get a copy of this message | ||
From: "Chris Hayes" <chayes@antenna.nl>
> >I would like to extract the quoted text from a string
> >for example : the translation for beautiful is "beau" and wonderful is
> >"formidable"
> >I need to get 'beau' and 'formidable' strings into an array.
> >
> >Any idea??
> >I can go with strpos and substrings, but maybe there is something more
> >convenient?
>
> I can imagine preg_match() with search pattern "/\"[[:alnum:]]*\"/Ui"
>
> See http://www.php.net/preg_match. You may need print_r to see
> where the
> desired result is in the array of matches.
Use preg_match_all(), otherwise you'll only get the first match.
---John Holmes...