生成二维数组吗?
#include <Array.au3>
Local $Str = _
'config1' & @CRLF & _
'a' & @CRLF & _
'b' & @CRLF & _
'c' & @CRLF & _
'config2' & @CRLF & _
'1' & @CRLF & _
'2' & @CRLF & _
'3' & @CRLF & _
'4' & @CRLF & _
'config3' & @CRLF & _
'aa' & @CRLF & _
'bb' & @CRLF & _
'cc' & @CRLF & _
'dd' & @CRLF & _
'ee'
MsgBox(0,'原始字符串',$str)
Local $Test = StringRegExp($str, '(?ms)(?<=config\d).*?(?=(?:config\d|\Z))', 3)
Local $Array[UBound($Test)][1],$K=1
For $i=0 to UBound($Test)-1
$tmp=StringRegExp($Test[$i],'[^\r\n]+',3)
If UBound($tmp)+1>$K Then
$K=UBound($tmp)+1
ReDim $Array[UBound($Array)][$K]
EndIf
$Array[$i][0]="CONFIG"&$I+1
For $n=1 to $K-1
$Array[$i][$n]=$tmp[$n-1]
Next
Next
_ArrayDisplay($Array)
|