php preg_replace:替换单词,即使其中有特殊字符

php preg_replace: Replace word, even with special chars in it

我需要查找并替换 "test" 这样的词,但即使其中包含 none-字母字符,例如:

test
t e s t
t.e.s.t
t-e-s-t
t.e-s(t
etc.

知道如何在 php 中执行此操作吗?也许 preg_replace?

试试这个:

preg_replace("/t\W?e\W?s\W?t/", "something", $input_array);