dollars sign in regular expressions
| From: | Glen Ogilvie | Date: | Wed, 16 Aug 2000 11:18:46 +0000 |
| Subject: | dollars sign in regular expressions | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-11964@lists.php.net to get a copy of this message | ||
Hi,
I am having difficulty understanding how to do the following RE, so anyone that
can explain, I would much appreicate it.
<?
$testval = 'this $name is a damn hard test <reason> because </reason';
\\ $year = preg_replace ("'\141', "G", $testval);
$year = ereg_replace ("\044", "G", $testval);
print "<html><body>testval: $testval, $year</body></html>";
?>
I am trying to replace the $ sign in this string with the letter G
This is so that I can use $name in an HTML file, read the file, and then
replace $name with a string value. For example
$name = "Glen";
$year = preg_replace ("'\044.+\W'", $name, $testval);
Thanks to everyone that looks at this problem.
Glen Ogilvie
New Zealand