Re: preg_match
| From: | James Lockie | Date: | Wed, 07 Feb 2007 03:30:53 +0000 |
| Subject: | Re: preg_match | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-248468@lists.php.net to get a copy of this message | ||
Myron Turner wrote:
James Lockie wrote:I am trying to use this code to display a button at the root but it always displays the button. :-( if (! (preg_match( "/$\/index.php/", $_SERVER['PHP_SELF'] ))) { # display a button ....You got the end-of-string character ($) in the wrong place: if (! (preg_match( "/\/index.php$/", $_SERVER['PHP_SELF'] ))) { Richard Lynch wrote:
On Tue, February 6, 2007 7:46 pm, James Lockie wrote:Thanks. if (! (preg_match( "/^\/index.php/", $_SERVER['PHP_SELF'] ))) { # display a buttonI am trying to use this code to display a button at the root but it always displays the button. :-(Without any "modifier", $ matches the END of the string. I wanted this. :-(if (! (preg_match( "/$\/index.php/", $_SERVER['PHP_SELF'] ))) {