Re: [問題] 關於regular expression

看板Perl作者 (努力吧)時間17年前 (2007/08/30 19:41), 編輯推噓2(200)
留言2則, 2人參與, 最新討論串4/6 (看更多)
請問 要把字串中有 &nbsp; 都刪除掉 應該用什麼來表示呢? 假設把網頁html存到 $temp 再用 foreach ($content) { s/<[^>]*>//g; } 把html標籤都去除 接著要 去除 &nbsp; 應該要怎麼寫才對呢? 謝謝高手們... ※ 引述《LiloHuang (相見不如懷念)》之銘言: : # 完全依照你給的測資跟output : $_ = qq~<font color = "red"><B>E2F-1</B></font> can also <font color = : "blue"><B>induce</B></font> <font color = "green"><B>p73</B></font> via a : p53-independent apoptotic pathway.~; : 1 while s/<[^>]+>[^<]*<\/[^>]+>//; : print; -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 163.25.10.199

08/31 00:31, , 1F
s/&nbsp;/ /g; 不就這樣嗎=_+
08/31 00:31, 1F

08/31 02:06, , 2F
感謝~
08/31 02:06, 2F
文章代碼(AID): #16rgpqKS (Perl)
討論串 (同標題文章)
文章代碼(AID): #16rgpqKS (Perl)