1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

@REREPLACE

Discussion in 'Support' started by vefatica, May 21, 2012.

  1. vefatica

    Joined:
    May 20, 2008
    Messages:
    7,777
    Likes Received:
    29
    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. vefatica

    Joined:
    May 20, 2008
    Messages:
    7,777
    Likes Received:
    29
    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
     
  3. rconn

    rconn Administrator
    Staff Member

    Joined:
    May 14, 2008
    Messages:
    9,722
    Likes Received:
    80
    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.
     
  4. vefatica

    Joined:
    May 20, 2008
    Messages:
    7,777
    Likes Received:
    29
    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.
     

Share This Page