[請益]要怎樣將特定的html tag所包夾的字串清掉
html source:
<p>These days, robots are more common than you might think. Consider the Roomba, a programmable robotic vacuum which cleans floors on its own.<br /><br />"We wanted to make something simple that people could use every day," says Helen Greiner, co-founder of iRobot, the company that makes the smart vacuum. "And that\'s what inspired us to build the Roomba." <div class=\'boxout photo230px\'><img src="http://media.voanews.com/images/230*173/inline-US_ROBOT_CONVENTION_04.jpg" width="230" height="173"
alt="Some robots, like the Roomba - a programmable robotic vacuum which cleans floors on its own - are already commonplace in many US households. " title="Some robots, like the Roomba - a programmable robotic vacuum which cleans floors on its own - are already commonplace in many US households. " border="0" /><h6 class=\'credit\'>iRobot</h6><span class=\'caption\'>Some robots, like the Roomba - a programmable robotic vacuum which cleans floors on its own - are already commonplace in many US
households.</span></div></p>'
想清掉被<div> </div>包含的字
但<div>裡面有時候又會放一些屬性,
我試了好多個php regex還是都失敗, 拜託高手指點
my trial:
preg_replace("/<div[.*]>[.*]<\/div>/i","", $string);
ps. regex好難
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.109.21.229
→
12/30 11:31, , 1F
12/30 11:31, 1F
→
12/30 11:32, , 2F
12/30 11:32, 2F
→
12/30 11:32, , 3F
12/30 11:32, 3F
→
12/30 13:04, , 4F
12/30 13:04, 4F
→
12/30 13:34, , 5F
12/30 13:34, 5F
→
12/30 14:41, , 6F
12/30 14:41, 6F
→
12/31 11:47, , 7F
12/31 11:47, 7F
→
12/31 11:53, , 8F
12/31 11:53, 8F
→
12/31 11:54, , 9F
12/31 11:54, 9F
→
12/31 11:55, , 10F
12/31 11:55, 10F
→
12/31 14:26, , 11F
12/31 14:26, 11F
→
12/31 14:26, , 12F
12/31 14:26, 12F
→
12/31 14:27, , 13F
12/31 14:27, 13F
→
12/31 14:27, , 14F
12/31 14:27, 14F
→
12/31 14:29, , 15F
12/31 14:29, 15F
推
01/06 19:38, , 16F
01/06 19:38, 16F
PHP 近期熱門文章
PTT數位生活區 即時熱門文章
6
14