$string = '@English is a West Germanic @language that was first spoken in early medieval @England and is now a global lingua franca. @It is spoken as a first language by the';
如何在一次操作中删除所有以@开头的单词?
linke str_replace()
怎么样?
`$result = 'is a West Germanic that was first spoken in early medieval and is now a global lingua franca. is spoken as a first language by the'`;
答案 0 :(得分:0)
你走了:
echo $string | sed -e 's/@\w*//g'
这将使用空字符串替换与正则表达式@ \ w *匹配的所有子字符串。 g标志确保匹配多个字符串。