AutoIt piece of code explain

08/29/2015 21:06 LiveLong23#1
Hi, it passed a long time since i was here and i get back :)

I found some interested piece of code so if anyone can explain me what he do i will be very appreciate.

Just please dont tell me to :rtfm:, i do but it is too complicated.

Code:
$tmp = StringRegExp(FileRead($file), '(?s)\[(\d+)\].*?\v1=(\V+)', 3)

;~  _ArrayDisplay($tmp, "Results")

Redim $matches[UBound($tmp)/2][3]
For $i = 0 to UBound($tmp)-1 step 2
	$matches[$i/2][0] = $i/2
	$matches[$i/2][1] = $tmp[$i]
	$matches[$i/2][2] = $tmp[$i+1]
Next
08/29/2015 21:42 alpines#2
It regexes a file which is built up probably like this
Code:
    [8888]abcde   1=
(?s) according to regex101 means: s modifier: single line. Dot matches newline characters
The \[(\d+)\] catches numbers which look like this [12345] [2132123] [12]
and the .*? means that it matches anything between the number and the \v.
The \v stands for a vertical tab sign and finally the (\V+) matches all the vertical tabs after the equal sign.

That's as much as I can see, there might be a few errors though.
08/29/2015 21:57 LiveLong23#3
And what about
Code:
Redim $matches[UBound($tmp)/2][3]
For Redim stand in help file

Resize an existing array.

ReDim $aArray[subscript 1]...[subscript n]

Parameters
-$aArray The name of the array to resize.
-subscript The number of elements to create for the array dimension, indexed 0 to n-1.

Then this one
Code:
$matches[UBound($tmp)/2]
Returns the size of array dimensions.

UBound ( Array [, Dimension = 1] )

Parameters
Array The array variable which is being queried.
Dimension [optional] Which dimension of a multi-dimensioned array to report the size of:
$UBOUND_DIMENSIONS (0) = Number of subscripts in the array
$UBOUND_ROWS (1) = Number of rows in the array (default)
$UBOUND_COLUMNS (2) = Number of columns in the array
Constants are defined in Constants.au3

Return Value
Success: the size of the array dimension.
Failure: 0 and sets the @error flag to non-zero.
@error: 1 = Array given is not an array.
2 = Array dimension is invalid.

So what it all do and this one too

Code:
For $i = 0 to UBound($tmp)-1 step 2
	$matches[$i/2][0] = $i/2
	$matches[$i/2][1] = $tmp[$i]
	$matches[$i/2][2] = $tmp[$i+1]
Next
08/30/2015 13:03 alpines#4
It iterates in a for loop from 0 to the size of $tmp -1 in 2 steps.
So it goes like this
Code:
For $i = 0 To 10 Step 2
$i = 0
$i = 2
$i = 4
.
.
.
The code inside the for loop rearranges the matches in a way that the script can handle it better.
In $matches[$i/2] you see that the $tmp Array contains 2 founds for every "line" therefore $i / 2 is used.
In [0] the index of the found is stored. ($i/2)
In [1] the 1. found of the "line" is stored ($tmp[$i])
In [2] the 2. found of the "line" is stored ($tmp[$i+1])