In article <[EMAIL PROTECTED]>,
[EMAIL PROTECTED] (Miguel Cruz) wrote:
> On Thu, 2 May 2002, Fredrik Arild Takle wrote:
> > eregi("$start(.*)end", $rf, $my_var);
> >
> > And I want it to stop at the first presedence of $end, not the last (thats
> > what this is doing).
>
> Try preg, which is faster and gives you more control (here the ?
> munificence operator).
>
> preg_match("/{$start}(.*?)end/", $rf, my_var);
Leave out the braces.
preg_match("/$start(.*?)end/", $rf, my_var);
-or-
preg_match("/$start(.*)end/U", $rf, my_var);
(And make sure the value of $start either doesn't have any regex special
chars, or is using them intentionally, or has them escaped
<http://php.net/preg-quote>.)
--
CC
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php