我一直在試圖找出一個小時。我只需要一個簡單的解決方法,我可以從中學習。 如何從下面的示例中刪除\ n的多次出現,並僅替換\ n的一次出現?謝謝preg_replace刪除多個 n
編輯:基本上我只是想刪除多個換行符並用一個換行符替換它們。
\n\n\n\n\n\n\n\n \n\n \n\n\n\n\n\n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n \n \n \n \n \n \n\n \n\n \n\n \nEDITION: U.S.\n\n \nINTERNATIONAL\n\n \nMÉXICO\n\n \n\n \nSet edition preference\n\n \n\n \n\n \n\n \nSign up\n\n \nLog in\n\n \n\n \n\n \n\n \n\n \n\n\n\n\n\n\n\n\n\n\n\n \n\n \n\n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \nHome\n\n \nVideo\n\n \nNewsPulse\n\n \nU.S.\n\n \nWorld\n\n \nPolitics\n\n \nJustice\n\n \nEntertainment\n\n \nTech\n\n \nHealth\n\n \nLiving\n\n \nTravel\n\n \nOpinion\n\n \niReport\n\n \nMoney\n\n \nSports\n\n \n\n \n\n\n\n\n\n \n\n\n\n\n\n\n\n \n\n\n\n \n\n\n\n\n\n\n \n\nupdated 10:02 a.m.EDT, Fri June 3, 2011\n\n\n\n\n\n \n\n\n\n\n\nDr. Jack Kevorkian dead at 83\n\n\n\n\n\n\nThe Michigan pathologist who put assisted suicide on the world\'s medical ethics stage, apparently died of a blood clot, according to his attorney. FULL STORY
不匹配 「[\ n] +」,並替換它「\ n」工作? – PeterT 2011-06-03 14:31:03
PeterT我剛試過你的方法,但現在沒有任何返回。 idk爲什麼。 – Dylan 2011-06-03 14:32:51
你用什麼代碼來替換。 PeterT有這個AFAIK的正確的正則表達式 – 2011-06-03 14:33:41