note 17579 added to function.preg-match
| From: | john_nospam_ at logontexas dot com | Date: | Fri, 14 Dec 2001 22:06:58 +0000 |
| Subject: | note 17579 added to function.preg-match | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-22827@lists.php.net to get a copy of this message | ||
Searching for the contents of a variable took a few minutes to figure out.
$search = "joebob";
ereg($search,$contents); works IF it doesn't time out.
preg_match($search,$contents); doesn't
Put it in a format preg understands with some delimiters:
$search_new = "'" . $search . "'";
preg_match($search_new,$contents);
Then you can put your i s g after the second single quote (ie, ."'is";).
--
http://www.php.net/manual/en/function.preg-match.php
http://master.php.net/manage/user-notes.php?action=edit+17579
http://master.php.net/manage/user-notes.php?action=delete+17579
http://master.php.net/manage/user-notes.php?action=reject+17579