Opened 14 years ago

Closed 14 years ago

#1669 closed Bug (Fixed)

RegExpReplace strips "\" from replacement string

Reported by: ResNullius Owned by: Jpm
Milestone: Component: AutoIt
Version: Severity: None
Keywords: StringRegExpReplace Cc:


Win 7 Pro & AutoIt

StringRegExpReplace strips backslashes from the replacement string. Doesn't appear to affect other special RegExp control characters in the replacement string

$str = "%CommonProgramFiles%\Microsoft Shared\"
MsgBox(0,"","Just to show that other special RegExp characters can be used in the replace string" & @CRLF & @CRLF & StringRegExpReplace($str, "%([^%]*?)%", "(?i)(?:^.*[0-9]$)"))
MsgBox(0,"","But the blackslashes get stripped from the replace string here: " & @CRLF & @CRLF & StringRegExpReplace($str, "%([^%]*?)%", "C:\WINDOWS\Some Other Folder"))

Attachments (0)

Change History (2)

comment:1 Changed 14 years ago by Jpm

In fact doc must be updated as back-references use "\". So they must be doubled in the replace string.

comment:2 Changed 14 years ago by Jpm

  • Milestone set to
  • Owner set to Jpm
  • Resolution set to Fixed
  • Status changed from new to closed

Fixed by revision [5871] in version:

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.

Add Comment

Modify Ticket

as closed The owner will remain Jpm.

E-mail address and user name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.