本帖最后由 afan 于 2012-5-8 16:43 编辑 #include <Array.au3>
Local $Str = _
'529 baidu.com/ (...) ' & @CRLF & _
'530 www.baidu1.com/ ???????? (...) 185 ' & @CRLF & _
'531 baidu2.com/index.asp (...) ' & @CRLF & _
'533 www.baidu3.com/ (...) ' & @CRLF & _
'534 www.baidu4.com.cn/ ????????? (...) 170 ' & @CRLF & _
'535 www.baidu5.com/ (...) ' & @CRLF & _
'536 www.baidu6.com/service.asp (...) ' & @CRLF & _
'537 www.baidu7.com.cn/ ????????? (...) 124 ' & @CRLF & _
'538 baidu8.com/ ???????????????? (...) 293 ' & @CRLF & _
'539 www.baidu9.com/ (...) ' & @CRLF & _
'540 www.baidu10.net/ ??????????? (...) 197 ' & @CRLF & _
'549 www.baidu11.com/?from=sst ??????????? (...) 123 ' & @CRLF & _
'560 www.baidu12.com/list.asp?ProdId=003-C-03-049 ???????? (...) 206 ' & @CRLF & _
'569 www.baidu13.com.cn/?.3847589.html ??????????? (...) 384 ' & @CRLF & _
'570 www.baidu14.com/ (...) ' & @CRLF & _
'571 www.baidu15.com/ ????????? (...) 238 ' & @CRLF & _
'572 www.baidu16.gov.com.cn/ ??????????????? (...) 340 ' & @CRLF & _
'573 ww.baidu17.org/ (...) ' & @CRLF & _
'574 www.baidu18.com.cn/ (...) ' & @CRLF & _
'575 baidu19.com/ ??????????? (...) 396 ' & @CRLF & _
'576 baidu20.com/ ????????? (...) 323 ' & @CRLF & _
'577 www.baidu21.org.cn/index.htm ????????????? (...) 327 '
;Local $str = FileRead('需提取的文档.txt') ;实际应用为读取文档
;MsgBox(0, '原字符串', $Str)
Local $shz = '(?:com|org|net|com.cn)' ;可以按格式修改后缀
Local $File = '提取网址.txt' ;输出文件
Local $Test = StringRegExp($str, '(?i)\H+?' & $shz, 3)
If @Error Then MsgBox(48, '错误', '未找到匹配的网址')
Local $sText = _ArrayToString($Test, @CRLF)
FileDelete($File)
FileWrite($File, $sText)
ShellExecute($File)
|