我想刪除內容中以#開頭的單詞。php刪除單詞開頭#
例如
$content = "#test Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry #test2 standard dummy text ever since the 1500s, when an unknown printer took a galley of type #test3 and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. #test4 It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum #test5."
這裏#爲test1,#TEST2,TEST3#,#TEST4,#TEST5是#字。我想刪除那些單詞。我使用preg_replace
。但它沒有得到輸出。
請幫幫我。謝謝
發佈您用來嘗試此操作的代碼。 –
這可能是非常接近,http://stackoverflow.com/questions/35711066/split-php-string-only-after-symbol/35711122#35711122(用'替換'交換'match_all'並交換'\ +'用'#'。如果沒有發佈你現在有的.. – chris85