Re: pcre functions help
| From: | Papp Gyozo | Date: | Sat, 06 Oct 2001 12:30:14 +0000 |
| Subject: | Re: pcre functions help | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-70217@lists.php.net to get a copy of this message | ||
or another solution:
if (preg_match('|(?<=\()(.+)(?=\()|i',$page,$matches)) {
$thedate = $matches[0];
}
----- Original Message -----
From: "php" <php@frontierit.com>
To: <php-general@lists.php.net>
Sent: Saturday, October 06, 2001 9:29 AM
Subject: [PHP] pcre functions help
> Hello all,
>
> I am playing with the prce functions...
>
> Just for examples sake I want to parse a page (string)
> and the date is in brackets.
>
> 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?
>
> thank you,
>
> Sean
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>