Opened 2 years ago
Last modified 20 months ago
#3976 assigned Bug
StringRegExp can create invalid arrays (just like StringSplit) — at Initial Version
| Reported by: | jchd18 | Owned by: | |
|---|---|---|---|
| Milestone: | Component: | AutoIt | |
| Version: | 3.3.16.1 | Severity: | None |
| Keywords: | Cc: |
Description
The issue raised by ticket #3972 applies as well to StringRegExp, for the very same reason.
Global $s = ' '
For $i = 0 To 24 Step 1
$s = $s & ";" & $s
Next
ConsoleWrite(StringLen($s) & @CRLF)
; String is now 33,554,432 symbols long with 33,554,431 delimiters
Global $a = StringRegExp($s, '(.[^;]*);?', 3) ; Also works with flag 4.
Global $err = @error, $ext = @extended
ConsoleWrite('@error = ' & $err & @CRLF) ; @error is not set, because delimiters were indeed found
ConsoleWrite('@extended = ' & $ext & @CRLF) ; Just to be sure it is also 0.
ConsoleWrite('VarGetType = ' & VarGetType($a) & @CRLF) ; It is an array
ConsoleWrite('UBound = ' & UBound($a) & @CRLF) ; UBound works (propably because Array-Metadata are set before the array is filled, I don't know the code so this is guesswork)
ConsoleWrite($a[0] & @CRLF) ; This will fail -> Array variable has incorrect number of subscripts
Note: See
TracTickets for help on using
tickets.
