Customer Portal

How to replace back slash in CTL2

Comments 1

  • Avatar
    Vladimir Barton
    0
    Comment actions Permalink
    Hi Mukunku,
    try changing your code to the following:

    replace(myString, "\\\\", "/");

    The reason why 4 backslashes are needed to reference one is that there are 2 levels of interpretation:
    • At first, CloverETL interprets the “\\\\” string as 2 backslashes (each one escaped by a backslash).

    • Then, the “\\” string is pushed to the ‘replace’ function as a regular expression. Note: the ‘replace’ function accepts regex expressions only as their second argument, more information can be found in our documentation). Similarly, “\\” is interpreted as “\” in regex (the backslash needs to be escaped by a backslash). More information can be found here.

    Kind regards,

Please sign in to leave a comment.