#include <Array.au3>
Local $sSource = _
'C:\新建文件夹\222222\sdfdf.exe' & @CRLF & _
'E:\sdfsdfdf\新建文件夹\222sd2\sd22df.exe' & @CRLF & @CRLF & _
'C:\Users\Administrator\Desktop\新建文件夹\360\11111.exe' & @CRLF & _
'C:\Users\Administrator\Desktop\新建文件夹\2345\er34.exe' & @CRLF & _
'C:\Users\Administrator\Desktop\新建文件夹\34567\dfdfg.bat' & @CRLF & @CRLF & _
'C:\Users\Administrator\Desktop\新建文件夹2\3600\1111441.exe' & @CRLF & _
'C:\Users\Administrator\Desktop\新建文件夹2\23450\er3334.exe' & @CRLF & _
'C:\Users\Administrator\Desktop\新建文件夹2\345670\dfd22fg.bat' & @CRLF & @CRLF & _
'C:\Users\Administrator\Desktop\新建文件夹3\3600\1111441.exe' & @CRLF & _
'C:\Users\Administrator\Desktop\新建文件夹3\23450\er3334.exe' & @CRLF & _
'C:\Users\Administrator\Desktop\新建文件夹3\345670\dfd22fg.bat' & @CRLF & @CRLF & _
'C:\Users\Administrator\Desktop\D3432323\新建文件夹3\345670\dfd22fg.bat' & @CRLF & @CRLF & _
'C:\Users\Administrator\Desktop\D3432323\DSFLKSJDF\新建文件夹3\345670\dfd22fg.bat'
;~MsgBox(0, '源字符串', $sSource)
Local $aSRE = StringRegExp($sSource, '(?mi)^\w:\V+(?=\\.+?\\[^\\]+$)', 3)
If Not @Error Then MsgBox(0, '匹配数量: ' & UBound($aSRE), '其中[0]元素为: ' & $aSRE[0])
_ArrayDisplay($aSRE, UBound($aSRE))
|