Skip to main content
ExLibris

Knowledge Assistant

BETA
 
  • Subscribe by RSS
  • Back
    Voyager

     

    Ex Libris Knowledge Center
    1. Search site
      Go back to previous article
      1. Sign in
        • Sign in
        • Forgot password
    1. Home
    2. Voyager
    3. Knowledge Articles
    4. GDC: Replace String with String cannot be executed with forward slashes

    GDC: Replace String with String cannot be executed with forward slashes

    1. Last updated
    2. Save as PDF
    3. Share
      1. Share
      2. Tweet
      3. Share
    1. Problem symptoms
    2. Cause
    3. Resolution
    • Article Type: General
    • Product: Voyager

    Problem symptoms

    Unable to use “replace string with string” consequence to replace forward slashes in a string with back slashes. Record transform fails when forward slashes are part of replace string.

    Cause

    This is result of java & rule engine syntax.

    Resolution

    When writing a “Replace String With String” rule that matches a backslash character (with the “Replace string is a regular expression” option unchecked), the “Replace String:” field must use four backslashes to match each backslash in the target record. Since the sought-after text in this instance has two backslashes, a total of 8 backslashes is required. This is due to the fact that the backslash character is an escape character in Java strings (this is not related to the use of regular expressions) and so two backslashes are needed to indicate a single backslash character. Then each of those backslashes must then be doubled again because the rule engine also regards the backslash as an escape character.

    If the “Replace string is a regular expression” option is checked then a total of eight backslashes is required to match a single backslash character, because the regular expression also considers each backslash to be an escape character.


    • Article last edited: 04-Mar-2015
    View article in the Exlibris Knowledge Center
    1. Back to top
      • GDC: Replace string with nothing
      • GDC: running time calculation in the log is way off
    • Was this article helpful?

    Recommended articles

    1. Article type
      Topic
      Language
      English
      Product
      Voyager
    2. Tags
      1. contype:kba
      2. Prod:Voyager
      3. Type:General
    1. © Copyright 2025 Ex Libris Knowledge Center
    2. Powered by CXone Expert ®
    • Term of Use
    • Privacy Policy
    • Contact Us
    2025 Ex Libris. All rights reserved