preg_match and $ sign in PHP5

From: Date: Tue, 06 Sep 2005 03:20:47 +0000
Subject: preg_match and $ sign in PHP5
Groups: php.general 
Request: Send a blank email to php-general+get-221877@lists.php.net to get a copy of this message
Hi, I have a regular expression check as: preg_match("/$xyz/", $data, $matches); And, as you know $xyz means "string starts with xyz". But somehow PHP 5 is interpreting this as variable xyz, and gives the notice below. You can ignore the message, but now it matches everything that has xyz, i.e. aaxyzbb PHP Notice: Undefined variable: xyz in /tmp/test.php Any idea about how I can specify "string starts with xyz" or fix it such that PHP5 won't recognize this as a variable? Thanks...

« previous php.general (#221877) next »