Hey.
Da ich es brauchte, hab ich mir eine Funktion geschrieben, welche mir dei Subpattern von StringRegExp in einem Zweidimensionalen Array zurück gibt.
Erkannt wird dowas bsw. noch nicht :
'\(.+\)'
[/autoit]Naja vllt. kann es ja jemand gebrauchen :
Spoiler anzeigen
Func _StringRegExpTo2DArray($sString, $sPattern)
;by Darter
Local $aUbound = StringRegExp($sPattern, '(\([^\)]+)+',3)
If @error Then Return SetError(1,'',-1)
$aUbound = UBound($aUbound)
Local $aArray[1][$aUbound], $k
Local $aMatches = StringRegExp($sString, $sPattern, 3)
If @error Then Return SetError(2,'',-1)
For $i = 0 To UBound($aMatches)-1 Step $aUbound
If $i = 0 Then
For $j = 0 To $aUbound -1
$aArray[0][$j] = $aMatches[$j]
Next
Else
ReDim $aArray[$i/$aUbound+1][$aUbound]
$k = 0
For $j = $i To $i + $aUbound -1
$aArray[UBound($aArray)-1][$k] = $aMatches[$j]
$k += 1
Next
EndIf
Next
Return $aArray
EndFunc
und hier ein Bsp. :
Spoiler anzeigen
#include <Array.au3>
[/autoit] [autoit][/autoit] [autoit]$sData = '<id="1" name="eins">' & @CRLF & _
'<id="2" name="zwei">' & @CRLF & _
'<id="3" name="drei">'
$aFound = _StringRegExpTo2DArray($sData, 'id="(\d+)".+name="(.+)"')
[/autoit] [autoit][/autoit] [autoit]_ArrayDisplay($aFound)
[/autoit] [autoit][/autoit] [autoit]Func _StringRegExpTo2DArray($sString, $sPattern)
;by Darter
Local $aUbound = StringRegExp($sPattern, '(\([^\)]+)+',3)
If @error Then Return SetError(1,'',-1)
$aUbound = UBound($aUbound)
Local $aArray[1][$aUbound], $k
Local $aMatches = StringRegExp($sString, $sPattern, 3)
If @error Then Return SetError(2,'',-1)
For $i = 0 To UBound($aMatches)-1 Step $aUbound
If $i = 0 Then
For $j = 0 To $aUbound -1
$aArray[0][$j] = $aMatches[$j]
Next
Else
ReDim $aArray[$i/$aUbound+1][$aUbound]
$k = 0
For $j = $i To $i + $aUbound -1
$aArray[UBound($aArray)-1][$k] = $aMatches[$j]
$k += 1
Next
EndIf
Next
Return $aArray
EndFunc
mfg Darter