Php 埃雷吉奥:更换问题!

Php 埃雷吉奥:更换问题!,php,regex,posix,Php,Regex,Posix,现在我遇到了一个eregi_替换问题: 我有这个 $subject = "This is for @codeworxx - you have to try first!"; $text = eregi_replace('(((@))[-a-zA-Z0-9]+)','<a href="http://www.google.de/\\1">\\1</a>', $subject); echo $text; $subject=“这是给@codeworxx的-你必须先试试!”; $

现在我遇到了一个eregi_替换问题:

我有这个

$subject = "This is for @codeworxx - you have to try first!";
$text = eregi_replace('(((@))[-a-zA-Z0-9]+)','<a href="http://www.google.de/\\1">\\1</a>', $subject);
echo $text;
$subject=“这是给@codeworxx的-你必须先试试!”;
$text=eregi_替换(“((@))[-a-zA-Z0-9]+”,“$subject);
echo$文本;
一切正常,但是
<a href="http://www.google.com/@codeworxx">@codeworxx</a>

但我想要这个:

<a href="http://www.google.com/codeworxx">codeworxx</a>

怎么办

谢谢,
Sascha

所有ereg_*函数在PHP5.3中都已被弃用,它们将在PHP6中消失。您应该改用preg_*函数。
<?php
$subject = "This is for @codeworxx - you have to try first!";
$text = eregi_replace('@([-a-zA-Z0-9]+)','<a href="http://www.google.de/\\1">\\1</a>', $subject);
echo $text;