Modify

Opened 16 years ago

Closed 16 years ago

Last modified 16 years ago

#1559 closed Feature Request (Fixed)

StringRegExpReplace - add Return Value in Helpfile

Reported by: script4ever Owned by:
Milestone: Future Release Component: Documentation
Version: Severity: None
Keywords: Cc:

Description

There are no Return Value in HelpFile for StringRegExpReplace.

This may be added:

Success: Returns array of matches. \0 contains input string. 
Failure/no match: Returns input string. 

Attachments (0)

Change History (5)

comment:1 by script4ever, 16 years ago

Return Value for Success should be mentioned:

Success: Returns replaced string. Replace expression \0 contains the full match. 

comment:2 by J-Paul Mesnage, 16 years ago

not sure to understand the "Replace expression \0 contains the full match"

comment:3 by GEOSoft, 16 years ago

JP
"\0" or "$0" as the replacement value will return the original string which is totaly usless IMHO. If I wanted the original string, why did i bother with any replace function?

The part that gets confusing is where script4ever says
"Success: Returns array of matches. \0 contains input string."
he may have meant [0] contains the original string but either way it's incorrect as far as I know. StringRegExpReplace() returns a string, not an array.
The part about
"Failure/no match: Returns input string."
Should probably be
"Failure/no match: Returns original string."
But that is just sematics.

Where he is correst is that both the successful return and the failure are missing from the documentation. All that is there is the @Error Values.

"Success: Returns the modified string. Check @Extended for the number of replacements performed.
Failure: Sets @Error to 2, pattern invalid. Check @Extended to get the offset of the error in the pattern."
along with, or in place of the current @Error Values is probably more appropriate.

comment:4 by J-Paul Mesnage, 16 years ago

Resolution: Fixed
Status: newclosed

Thanks George,
I can close it now as I have updated the doc almost the same way as you suggest.

comment:5 by TicketCleanup, 16 years ago

Milestone: Future Release

Automatic ticket cleanup.

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.