Sign in to follow this  
Followers 0
mary

Array of arrays returned by StringRegExp

6 posts in this topic

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].

Share this post


Link to post
Share on other sites



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

Share this post


Link to post
Share on other sites

Unknown arrays can get confusing, viewing them before writing your method can help..

#include <Array.au3>

_ArrayDisplay($yourArray)

Share this post


Link to post
Share on other sites

so it is impossible without creating an other variable ? :D

thanks !

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

so it is impossible without creating an other variable ? :D

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

:D

Edited 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

Share this post


Link to post
Share on other sites

Yes.

Ok, thanks PsaltyDS for this precision.

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0