$File = FileOpen("b.txt", 0) $Source = FileRead($File) FileClose($File) $array = StringRegExp($Source, '?s(?<=<div\sclass="gs1">).*?(?=<\/div>)', 1) MsgBox(0, "", @error)
<body> 古诗一 <div class="gs1"> 1白日依山尽 2黄河入海流 3欲穷千里目 4更上一层楼</div> 古诗二 <div class="gs2"> a春眠不觉晓 b处处闻啼鸟 c夜来风雨声 d花落知多少 </div> <body>
举报
原帖由 clonecd 于 2008-7-10 17:14 发表 $File = FileOpen("b.txt", 0) $Source = FileRead($File) FileClose($File) $res = StringRegExpReplace($Source, "\x3c[^\x3e]*\x3e", "") MsgBox(0, "", $res)
$File = FileOpen("b.txt", 0) $Source = FileRead($File) FileClose($File) $res = StringRegExpReplace($Source, "\x3c[^\x3e]*\x3e", "") MsgBox(0, "", $res)
#include "array.au3" $File = FileOpen("b.txt", 0) $Source = FileRead($File) FileClose($File) $array = StringRegExp($Source, '[^\x00-\xff]+', 3); ;~ _ArrayDisplay($array) If IsArray($array) Then $newtxt = _ArrayToString($array, @CRLF) MsgBox(0, "提取到的中文字符", $newtxt) EndIf
$array = StringRegExp($Source, '(?<=<div\sclass="gs1">)(?s).*?(?=<\/div>)', 2)
呵呵,不错, 我也来个,反其道而行, pcbar 发表于 2008-7-10 17:25
本版积分规则 发表回复 回帖后跳转到最后一页
|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度
GMT+8, 2025-2-27 19:57 , Processed in 0.093660 second(s), 19 queries .
Powered by Discuz! X3.5 Licensed
© 2001-2024 Discuz! Team.