@REREPLACE

  • This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.
#1
The @REREPLACE page is missing from the help (or at least from the index). Clicking @REREPLACE in "What's new" takes you to the @SERIALPORTCLOSE page.

I don't know whether @REREPLACE is supposed to act exactly like @XREPLACE, but I can't do this one with @REREPLACE:

Code:
v:\> echo %@xreplace["My dog has (.*)",\1,My dog has fleas.]
fleas.
 
v:\> echo %@rereplace["My dog has (.*)",\1,My dog has fleas.]
TCC: (Sys) The parameter is incorrect.
"%@rereplace["My dog has (.*)",\1,My dog has fleas.]"
 
#2
OK, if I leave out the quotes, it works:
Code:
v:\> echo %@rereplace[My dog has (.*),\1,My dog has fleas.]
fleas.
And commas in either re must be escaped ... right ... that's OK.
Code:
v:\> echo %@xreplace["(?i)[a-z]*, (.*)",\1,Fatica, Vincent]
Vincent
 
v:\> echo %@rereplace[(?i)[a-z]*^, (.*),\1,Fatica, Vincent]
Vincent
 
#4
It would be surprising if it did, since I've never seen or used @XREPLACE.



I added support for (unnecessary) surrounding quotes in 14.0.16.
I wasn't asking for that ... only figuring out how it worked. @XREPLACE uses quotes to protect commas in the RE and the replacement string. I like @REREPLACE's approach better ... let the user escape such quotes ... because in nearly all such instances, he can do so because he's composing those two parameters.