Modify

Opened 15 years ago

Closed 15 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 by GEOSoft, 15 years ago

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.

comment:2 by Jon, 15 years ago

Resolution: Works For Me
Status: newclosed

Modify Ticket

Action
as closed The ticket will remain with no owner.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.