REGEX prob
| From: | n e t b r a i n | Date: | Sat, 17 Feb 2001 20:49:29 +0000 |
| Subject: | REGEX prob | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-40338@lists.php.net to get a copy of this message | ||
Hi all,
I'm trying to match a particular piece of string in a big string using a
regex in order to change it whith another value ... I mean:
eg:
$html="<a
href=link.htm?&flag=982420537&PHPSESSID=2c86b460d360b13c3ef08b8a46b9cafc>Lnk
</a>";
function change_sess(&$html_code){
if(eregi("&flag=[0-9]{9}&PHPSESSID=[[:alnum:]]{32}",$html_code)){
str_replace("&flag=[0-9]{9}&PHPSESSID=[[:alnum:]]{32}","<?=append_url();?>",
$html_code);
}
}
change_sess($html);
...
$fp=fopen($my_file,"w");
fwrite($fp,$html);
...
But open the $my_file, the changes are not applied ... (I mean: there's
always the original string -->
&flag=982420537&PHPSESSID=2c86b460d360b13c3ef08b8a46b9cafc)
Anyone could help me, please?
many thanks in advance
max