#12042 [Com]: $ can't be escaped when using ereg function
| From: | collection-cellophane1868 at hotmail dot com | Date: | Tue, 20 Jul 2004 15:09:43 +0000 |
| Subject: | #12042 [Com]: $ can't be escaped when using ereg function | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-63041@lists.php.net to get a copy of this message | ||
ID: 12042
Comment by: collection-cellophane1868 at hotmail dot com
Reported By: teocl at globalsources dot com
Status: Bogus
Bug Type: *Regular Expressions
Operating System: LINUX
PHP Version: 4.0.6
New Comment:
<a href=http://a-fantasycellophane.da.ru>collection
cellophane</a>
Previous Comments:
------------------------------------------------------------------------
[2001-07-11 05:51:51] zak@php.net
This is known and expected behavior. Please review the regex docs more
carefully - also search the php-general mailing list archives.
The quick fix is to place 3 backslashes in front of the $.
------------------------------------------------------------------------
[2001-07-11 05:46:09] teocl at globalsources dot com
Please see the codes below:
<?
$arrfile = '<?include("$DOCUMENT_ROOT/TEMPLATES/TOP-BANNER.HTM");?>';
if(eregi("<\?include\(\"\$DOCUMENT_ROOT/TEMPLATES/TOP-BANNER\.HTM\"\);\?>",$arrfile))
print "good\n";
else
print "bad\n";
?>
The result will return "bad" because the eregi can't find the
expression in the $arrfile. If I removed the $, it will return "good".
I guess "$" can't be escaped inside the eregi function. Please help.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=12042&edit=1