Modify

Opened 17 years ago

Closed 17 years ago

#734 closed Feature Request (Completed)

Docs update for StringRegExpReplace()

Reported by: MrCreatoR Owned by: Valik
Milestone: 3.2.13.13 Component: Documentation
Version: Severity: Blocking
Keywords: RegExp Replace Back-Reference Cc:

Description

I think there is few things in the RegExp(Replace) engine's docs that should be updated, one is the back-reference of the "Replace" parameter.

For example, if we need to add some number to $1 (right after it) so the result will include the first found group and the added number, then we can do it like this:

$sRegExp_Res = StringRegExpReplace("Some string <NEEDED STRING 1> Some data", ".*<(.*)>.*", "${1}00")

MsgBox(0, "Result", $sRegExp_Res)

We don't know about it from the docs (it's taken from Perl RegExp methods).

If we remove the brakets of $1, then we get wrong results (expecting NEEDED STRING 100).
I think the docs needs to be updated, just add something like this:

replace - The text to replace the regular expression matching text with. To insert matched group text, \0 - \9 (or $0 - $9) can be used as back-references.

To seperate back-references from actual (replaced) numbers, wrap it with half-round brackets, i.e: "${1}5".

Here is the second line that was added.

Thanks.

Attachments (0)

Change History (3)

comment:1 by TicketCleanup, 17 years ago

Version: 3.2.12.1

Automatic ticket cleanup.

comment:2 by Valik, 17 years ago

Owner: set to Valik
Severity: NoneBlocking
Status: newaccepted

comment:3 by Valik, 17 years ago

Milestone: 3.2.13.13
Resolution: Completed
Status: acceptedclosed

Modify Ticket

Action
as closed The owner will remain Valik.

Add Comment


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