请教一个正则的写法
"/ab/abc/abcd/111.txt"<div class="container-xl clear-padding-sm my-3 py-1"><div class="card"> 花都区业余体育学校df
<div class="card-body"> FDS23RFS
<div class="page-header page-header-border mt-0">a "/ab24/111.zip"djfaksjfd=3jsdkfjak2jm,,M<.,.dsfjljsd,.,.M<Mkjkdjfkd,"/a93md/D/12345.txt" ASDFASF
需要找出下面的数据
/ab/abc/abcd/111.txt
/ab24/111.zip
/a93md/D/12345.txt
#include <Array.au3>
Local $sSource = _
'"/ab/abc/abcd/111.txt"<div class="container-xl clear-padding-sm my-3 py-1">' & @CRLF & _
' <div class="card"> 花都区业余体育学校df' & @CRLF & _
' <div class="card-body"> FDS23RFS' & @CRLF & _
' <div class="page-header page-header-border mt-0">a "/ab24/111.zip"djfaksjfd=3jsdkfjak2jm,,M<.,.dsfjljsd,.,.M<Mkjkdjfkd,"/a93md/D/12345.txt" ASDFASF'
;~ MsgBox(0, '源字符串', $sSource)
Local $aSRE = StringRegExp($sSource, '"([^"]*?(?:.txt|.zip))"', 3)
If Not @Error Then MsgBox(0, '匹配数量: ' & UBound($aSRE), '其中元素为: ' & $aSRE)
_ArrayDisplay($aSRE, UBound($aSRE))
A神的神器: au3.rehelper调试出来的 可以用,就是看不懂这个[^"]* ,为什么要这么写 如果不对引号进行限制的话,第二条记录与楼主的要求不符合,多了:图片中蓝色部分
"(/.*?\.\w{1,3})"
页:
[1]