4
我需要刪除搜索字符串的下一個單詞..我有陣列('aa','bb','é')搜索數組;PHP刪除搜索字符串旁邊的單詞
這是我的段落'你好,這是一個測試段aa 123測試bb 456'。
在這一段我需要刪除123和456
$pattern = "/\bé\b/i";
$check_string = preg_match($pattern,'Hello, this is a test paragraph aa 123 test é 456');
如何獲得下一個單詞?請幫忙。
我想你的代碼,但它不會刪除123和456 – Kathiravan
@Kathiravan:它確實對我來說。你使用的是什麼版本的PHP? –
我不知道preg_replace函數preg_replace(「/ $ search_string \ s +(\ w +)/」,「$ 1」,$ string);這裏$ 1會做什麼。 – Kathiravan