Announcement

Collapse
No announcement yet.

1.5 Regular Expressions

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • 1.5 Regular Expressions

    Hi,

    Just wondering if someone give an example of how to use the regular expression form in the transformer. I need to replace a ' (single quote) with " " (null).

    What I have
    Regular expression: '
    ReplaceWith: ""

    Any help is appreciated.

  • #2
    Re:1.5 Regular Expressions

    You might want to do this in the preprocessor script if you are trying to remove all 's from your message. I think it is something like:

    return message.replace(/\\u002c/g, "");

    If that doesn't work, Chris would know how to answer this better than me (he loves regular expressions).

    Post edited by: brendanh, at: 05/30/2007 15:52
    Brendan Haverlock | Mirth Software Engineer | Mirth Corporation

    Comment


    • #3
      Re:1.5 Regular Expressions

      Regular Expression:

      /'/g

      Replace with:

      ""
      Chris Lang

      Comment


      • #4
        Re:1.5 Regular Expressions

        That won't compile buddy.
        Brendan Haverlock | Mirth Software Engineer | Mirth Corporation

        Comment


        • #5
          Re:1.5 Regular Expressions

          Try:
          Code:
          /\\\\'/g
          Post edited by: chrisl, at: 05/31/2007 02:21
          Chris Lang

          Comment


          • #6
            Re:1.5 Regular Expressions

            I couldn't get that to work, it doesn't like
            Code:
            /\\\\'/g
            ,

            Code:
            /\\'/g
            is accepted but does not remove the '.

            I used the following in the preprocessing script and it worked:

            Code:
            var reg = new RegExp();
            reg.compile("'", "g"«»);
            return message.replace(reg,(""«»));
            Post edited by: mulaa, at: 05/31/2007 14:03

            Comment

            Working...
            X