Re: using preg_match
| From: | Christian Haensel | Date: | Wed, 16 May 2007 12:21:06 +0000 |
| Subject: | Re: using preg_match | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-255014@lists.php.net to get a copy of this message | ||
Hi Ed,
did you try the backslash as escape character?
<?
$path = "testing/realtors/userdata/";
if(preg_match("/\/realtors/", $path)) {
echo 'Success';
}
?>
Works for me :o)
Maybe try http://de3.php.net/manual/en/function.preg-match.php too see some examples.
Good luck
Chris
----- Original Message ----- From: "Ed Curtis" <e_curtis@homes2see.com>
To: <php-general@lists.php.net>
Sent: Wednesday, May 16, 2007 2:12 PM
Subject: [PHP] using preg_match
I'm trying to use preg_match to find a string in a system path. What I need to do is see if the string '/realtors' exists in a variable named '$path'. I know '/' is used as a container within the command itself. How do I escape it to find the string '/realtors'? Thanks, Ed -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php