#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 , 16 years ago
comment:2 by , 16 years ago
not sure to understand the "Replace expression \0 contains the full match"
comment:3 by , 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 , 16 years ago
| Resolution: | → Fixed |
|---|---|
| Status: | new → closed |
Thanks George,
I can close it now as I have updated the doc almost the same way as you suggest.

Return Value for Success should be mentioned: