Announcement

Collapse

Mirth Connect 3.12.0 Released!

Mirth Connect 3.12.0 is now available as an appliance update and on our GitHub page. This release includes database performance improvements, improves visual HL7 representation, message pruning, keystore handling, PDF generation, community contributions, and fixes several security vulnerabilities. This release also contains many improvements to commercial extensions. See the release notes for the list of fixes and updates.

Download | See What's New | Upgrade Guide | Release Notes

For discussion on this release, see this thread.
See more
See less

Regex problem?

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

  • Regex problem?

    My source transformer contains a mapper set to replace a string with regular expression "^\[.*\]\[MAPLe.*\]$" and the replace with set to "MAPLE"

    The source string is "[RRIT + Access Application/Urgency][MAPLe + Access Application/Urgency]" but the source transformer does not perform the replacement.

    I tested my regex using the regular expression tester at http://regexlib.com/RETester.aspx and it does find the match. Am I doing something wrong in Mirth?

  • #2
    Re:Regex problem?

    That regex tester seems to be .NET oriented, find one for Java to test with.

    You also need to esacpe your square brackets. You want the [] characters and not [] indicating a character class. So "^\[.*\]\[MAPLe.*\]$"
    Jon Bartels

    Zen is hiring!!!!
    http://consultzen.com/careers/
    Talented healthcare IT professionals wanted. Engineers to sales to management.
    Good benefits, great working environment, genuinely interesting work.

    Comment


    • #3
      Re:Regex problem?

      Yes, I actually have escaped the square brackets. This forum strips out slashes. each square brack is actually escaped.

      The link I gave also does client side regex using either vbscript or javascript.

      Post edited by: jerchap, at: 08/01/2008 10:45

      Post edited by: jerchap, at: 08/01/2008 10:46

      Post edited by: jerchap, at: 08/01/2008 10:47

      Comment


      • #4
        Re:Regex problem? (Solved)

        Figured it out! Not sure why I didn't think of it before. but if you are escaping something in a regex string you need to put two slashes instead of just one, because javascript/c/c++ also uses the slash as an escape character, so you need two slashes in the regex string to get a literal slash.

        Comment


        • #5
          Re:Regex problem? (Solved)

          This trick for long SQL queries and quoting might apply to the regex as well: http://www.mirthproject.org/index.ph...2&id=6769#6769

          Basically you just wrap your formatted strings in CDATA tags and let the javascript interpreter/parser figure it out.
          Jon Bartels

          Zen is hiring!!!!
          http://consultzen.com/careers/
          Talented healthcare IT professionals wanted. Engineers to sales to management.
          Good benefits, great working environment, genuinely interesting work.

          Comment

          Working...
          X