ホームページ >バックエンド開発 >PHPチュートリアル >定期的に質問する
原字文字列:
8c0e9d2c5e6a7ea41578d97b4d80f7d8
e87698cb9d29c84654771221b6fe0951
46ff8f07fb4c19a078e5441b9c4350ccla belle0fe0b7695b8025b8365ca0c050e039db
f2acd4d65d7ce786c85bb078648d287fクールブ デ0fe0b7695b8025b8365ca0c050e039db
a6d0a979d028e176e2407d2e4ae7fd35パフェコムメ0fe0b7695b8025b8365ca0c050e039db
c4b6b421cd638c3b9e94d8585347bc79cadeau pour votre amureux0fe0b7695b8025b8365ca0c050e039db
62ba19b687b008e33a2beccb1a860905
a3632a6313b08428453d6ceb6953d380注0fe0b7695b8025b8365ca0c050e039db
3b86794253743106c22aad370366f264: レーバー0fe0b7695b8025b8365ca0c050e039db
ae8caf2bea2690b2e3f28bddc7a12607à la main0fe0b7695b8025b8365ca0c050e039db
0fe0b7695b8025b8365ca0c050e039db
$arr1=array('#c4a3079876ec3f441741771f04fb5eb7]+>([^<]+)0fe0b7695b8025b8365ca0c050e039dbrn#i ','#f37785294bb10bcd4e7faa035cecea1e]*>#i','#e2351ee34ea209ba61c4efb0a4aff7c8rn#i');
$arr2=array('$1 ', '
', '');
preg_replace($arr1, $arr2, $str);
rn は Windows 文本换行符,要注意对应文本の格式
没環境测试,自己摸索一下吧
$str1 = '8c0e9d2c5e6a7ea41578d97b4d80f7d8
e87698cb9d29c84654771221b6fe0951
46ff8f07fb4c19a078e5441b9c4350ccla belle0fe0b7695b8025b8365ca0c050e039db
f2acd4d65d7ce786c85bb078648d287fクールド0fe0b7695b8025b8365ca0c050e039db
28085fcd055ce2e92fa613fe543cb43b
a6d0a979d028e176e2407d2e4ae7fd35パフェコムメ0fe0b7695b8025b8365ca0c050e039db
c4b6b421cd638c3b9e94d8585347bc79cadeau pour votre amureux0fe0b7695b8025b8365ca0c050e039db
62ba19b687b008e33a2beccb1a860905
a3632a6313b08428453d6ceb6953d380注0fe0b7695b8025b8365ca0c050e039db
3b86794253743106c22aad370366f264: 海苔0fe0b7695b8025b8365ca0c050e039db
ae8caf2bea2690b2e3f28bddc7a12607à la main0fe0b7695b8025b8365ca0c050e039db
0fe0b7695b8025b8365ca0c050e039db
$s =<<< TXT<LI> <SPAN id=result_box lang=fr c="4" a="undefined" zd="null" closure_uid_235198886="43"> <SPAN class=hps zd="null" closure_uid_235198886="1391">la belle</SPAN> <SPAN class=hps zd="null" closure_uid_235198886="1392">courbe de</SPAN> <BR zd="null" closure_uid_235198886="1410"> <SPAN class=hps zd="null" closure_uid_235198886="1399">Parfait comme</SPAN> <SPAN class=hps zd="null" closure_uid_235198886="1400">cadeau pour votre amoureux</SPAN> <BR zd="null" closure_uid_235198886="1411"> <SPAN class=hps zd="null" closure_uid_235198886="1401">NOTE</SPAN> <SPAN zd="null" closure_uid_235198886="1402">: Laver</SPAN> <SPAN class=hps zd="null" closure_uid_235198886="1403">à la main</SPAN> </SPAN> <LI>TXT;echo strip_tags($s, '<li><br>');
$str1 = '<LI> <SPAN id=result_box lang=fr c="4" a="undefined" zd="null" closure_uid_235198886="43"> <SPAN class=hps zd="null" closure_uid_235198886="1391">la belle</SPAN> <SPAN class=hps zd="null" closure_uid_235198886="1392">courbe de</SPAN> <BR zd="null" closure_uid_235198886="1410"> <SPAN class=hps zd="null" closure_uid_235198886="1399">Parfait comme</SPAN> <SPAN class=hps zd="null" closure_uid_235198886="1400">cadeau pour votre amoureux</SPAN> <BR zd="null" closure_uid_235198886="1411"> <SPAN class=hps zd="null" closure_uid_235198886="1401">NOTE</SPAN> <SPAN zd="null" closure_uid_235198886="1402">: Laver</SPAN> <SPAN class=hps zd="null" closure_uid_235198886="1403">à la main</SPAN> </SPAN> <LI>';$reg = "/<span(.*)>|<\/span>|zd=\"(.*)\"|closure_uid_235198886=\"(.*)\"/iU";$str = preg_replace($reg, '', $str1);var_dump($str);exit;
$str1 = '<LI> <SPAN id=result_box lang=fr c="4" a="undefined" zd="null" closure_uid_235198886="43"> <SPAN class=hps zd="null" closure_uid_235198886="1391">la belle</SPAN> <SPAN class=hps zd="null" closure_uid_235198886="1392">courbe de</SPAN> <BR zd="null" closure_uid_235198886="1410"> <SPAN class=hps zd="null" closure_uid_235198886="1399">Parfait comme</SPAN> <SPAN class=hps zd="null" closure_uid_235198886="1400">cadeau pour votre amoureux</SPAN> <BR zd="null" closure_uid_235198886="1411"> <SPAN class=hps zd="null" closure_uid_235198886="1401">NOTE</SPAN> <SPAN zd="null" closure_uid_235198886="1402">: Laver</SPAN> <SPAN class=hps zd="null" closure_uid_235198886="1403">à la main</SPAN> </SPAN> <LI>';$reg = "/<span(.*)>|<\/span>|zd=\"(.*)\"|closure_uid_235198886=\"(.*)\"/iU";$str = preg_replace($reg, '', $str1);var_dump($str);exit;
$patterns = array(
'/605f38109a1044bf25b11a645f937735]*>/i',
'/54bdf357c58b8a65c66d7c19c8e4d114/i ',
);
$replace = array(
'',
'',
'0c6dc11e160d3b678d68754cc175188a',
);
echo preg_replace($patterns, $replace, $str);
これは問題ありません。