Re: pcre functions help
| From: | Rasmus Lerdorf | Date: | Sat, 06 Oct 2001 08:17:19 +0000 |
| Subject: | Re: pcre functions help | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-70210@lists.php.net to get a copy of this message | ||
> ie $page = "adsfasdfadsfadsf (10/10/01 4:00:00PM) adsfadsf";
>
> now if i use:
>
> if (preg_match('/\(.+\)/i',$page,$matches)) {
> $thedate = $matches[0];
> }
>
> $thedate will return (10/10/01 4:00:00PM)
> when all I really want is whats BETWEEN the brackets, ie 10/10/01 4:00:00PM
>
> is there a "better" way to match, so that my "matching" criteria is
> excluded?
if (preg_match('/\((.+)\)/i',$page,$matches)) {
$thedate = $matches[1];
}
-Rasmus