Opened 14 years ago
Closed 14 years ago
#1825 closed Bug (Works For Me)
StringRegExpReplace - returns bad @extended value
Reported by: | Zedna | Owned by: | |
---|---|---|---|
Milestone: | Component: | AutoIt | |
Version: | 3.3.5.6 | Severity: | None |
Keywords: | Cc: |
Description
In the helpfile at StringRegExpReplace is stated:
"Check @Extended for the number of replacements performed."
But when I use backreference group of the same number more than once then it counts to @extended more times too.
See this small selfexplanatory commented example:
$input = 'column1,column2,column3,' $output = StringRegExpReplace($input, '(\w{1,}),', '$1 = o2, ') ; $1 used 1x If Not @error Then MsgBox(0,'OK extended: ' & @extended,$output) ; @extended = 3 $output = StringRegExpReplace($input, '(\w{1,}),', '$1 = o2\.$1, ') ; $1 used 2x If Not @error Then MsgBox(0,'OK extended: ' & @extended,$output) ; @extended = 6 (should be 3)
So it's not corresponding to number of replacements, should be 3 in second example.
I expect as number of replacements number of "matches" in this case which is always 3 in my examples.
In current implementation it corresponds to "number of placements of all matching groups from replace parameter to reult string."
Anyway if it's intended behaviour then documentation should be changed at least.
Tested on 3.2.12.1 and latest beta 3.3.5.6 with the same result.
Attachments (0)
Change History (2)
comment:1 Changed 14 years ago by GEOSoft
comment:2 Changed 14 years ago by Jon
- Resolution set to Works For Me
- Status changed from new to closed
Guidelines for posting comments:
- You cannot re-open a ticket but you may still leave a comment if you have additional information to add.
- In-depth discussions should take place on the forum.
For more information see the full version of the ticket guidelines here.
What seems to be the problem? The second example is replacing $1 6 times just like you told it to do. "$1 = o2\.$1, " times 3.
If anything it may need a clarification in the docs.