Re: Getting part of string matched with regular expressions
| From: | Paul Scott | Date: | Mon, 28 Jan 2008 05:32:15 +0000 |
| Subject: | Re: Getting part of string matched with regular expressions | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-268188@lists.php.net to get a copy of this message | ||
On Mon, 2008-01-28 at 14:28 +0900, Teck wrote:
> I was using preg_replace for this, and try to delete (i.e., replace
> the non-matched part with an empty string) the second part, but I
> can't make it work.
Rather use preg_match_all() as that will produce an array of values,
with the first value being the original that you can then compare with.
--Paul