0
我想用{用戶名}替換任何twitter @用戶名。我現在有下文中,用戶更換@username:用標籤替換Twitter用戶名
$string = "Tweet with @UserName in the string"
echo preg_replace('/@([a-z0-9_]+)/i', ' USER ', $tweet);
// Tweet with USER in the string
是否有可能修改的preg_replace使得其輸出是
Tweet with {UserName} in the string
?
難道你不應該逃避{}嗎? – powtac 2012-02-05 20:49:29
它似乎無需逃避它的工作。 – drew010 2012-02-05 20:51:50
重印你的筆記:不應該忽略電子郵件地址?這只是我正在尋找的用戶名:) – Pr0no 2012-02-05 20:53:49