【发布时间】:2014-02-06 14:13:14
【问题描述】:
我已经搜索过这个例子,但似乎找不到。
我希望用字符串替换所有内容,但 @texthere
$Input = this is @cool isn't it?
$输出 = @cool
我可以使用preg_replace("/@(\w+)/", "", $Input); 删除@cool,但不知道如何做相反的事情
【问题讨论】:
-
用
preg_match匹配想要的字符串,然后分配$output = $extracted_string。
标签: php preg-replace