mary Posted April 13, 2008 Posted April 13, 2008 Hi! StringRegExp with flag 4 gives me an array of arrays but how we can get values ? he an exemple : $array=StringRegExp("blabla10%##;blaba20{;blabal50#;blabla","(\d+).*?;",4) consolewrite($array[0][1]);==> here it gives me error (array dimension) [b]Flag 4[/b] :[i]Return an array of arrays containing global matches including the full match (Perl / PHP style)[/i].
ProgAndy Posted April 13, 2008 Posted April 13, 2008 This way: ;create Array Dim $a[2]= [1,2] ;Array of Arrays Dim $b[3] $b[0] = $a Get Array in single Variable to use it: $c = $b[0] MsgBox(0,"Test",$c[0]) *GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes
LogicalAI Posted April 13, 2008 Posted April 13, 2008 Unknown arrays can get confusing, viewing them before writing your method can help.. #include <Array.au3> _ArrayDisplay($yourArray)
mary Posted April 13, 2008 Author Posted April 13, 2008 so it is impossible without creating an other variable ? thanks !
PsaltyDS Posted April 13, 2008 Posted April 13, 2008 (edited) so it is impossible without creating an other variable ? Yes. Working with nested arrays requires reading them out to a variable first. AutoIt has no provision for addressing elements in nested arrays. $array = StringRegExp("blabla10%##;blaba20{;blabal50#;blabla", "(\d+).*?;", 4) ConsoleWrite("Debug: $array has " & UBound($array) & " entries." & @LF) For $a = 0 To UBound($array) - 1 $Temp = $array[$a] If IsArray($Temp) Then ConsoleWrite("Debug: " & $a & ": $Temp has " & UBound($Temp) & " entries." & @LF) For $n = 0 To UBound($Temp) - 1 ConsoleWrite("Debug: " & @TAB & "[" & $n & "] = " & $Temp[$n] & @LF) Next EndIf Next Edited April 13, 2008 by PsaltyDS Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now