Hello,
I use the following regular expressions of PHP in a class.
It's purpose is to add the parameter "interlang" to every anchor in the string $neuezeile.
It works fine, but it's really slow. So I read about the very fast PCRE functions, but I don't get them running properly.
if(stristr($neuezeile,"<a href=")){
if(!eregi("<a href=\"(.+)interlang(.+)\"",$neuezeile) && !eregi("<a href=\"#(.+)\"",$neuezeile) && !eregi("<a href=\"http:(.+)\"",$neuezeile)){
if(eregi("<a href=\"(([[:alnum:]]|)+).php\?(.+)\"",$neuezeile)){
$neuezeile = eregi_replace("<a href=\"(([[:alnum:]]|)+).php\?(([[:alnum:]]|=||.)+)\"(([[:alnum:]]|=|\"| ))>","<a href=\"\1.php?\3&interlang=".$interlang."\"\5>",$neuezeile);
}
else{
$neuezeile = eregi_replace("<a href=\"(([[:alnum:]]|)+).php\"(([[:alnum:]]|=|\"| ))>","<a href=\"\1.php?interlang=".$interlang."\"\3>",$neuezeile);
}
}
}
I've already read the extensive http://www.php.net/manual/de/pcre.pattern.syntax.php article, but that didn't help.
I want to use the regular expressions working with the PCRE functions, but I fail to adapt them to the Perl style.
Please help.