Mirth Community

Mirth Community (http://www.mirthcorp.com/community/forums/index.php)
-   Support (http://www.mirthcorp.com/community/forums/forumdisplay.php?f=6)
-   -   Invalid quantifier ? when using Lookbehind regex (http://www.mirthcorp.com/community/forums/showthread.php?t=215624)

batejo 02-19-2016 10:26 AM

Invalid quantifier ? when using Lookbehind regex
 
Hi,

I'm trying to use in a transformer a regular expression to match some data but I'm getting this error.

Here is an example of what I am doing.

The data:

Code:

<value name="VALUE" type="Numeric" unit="Ohm">
    3000
    <escape type="GREATER_THAN_MAX" />
</value>

What I want to match is what is inside the escape.type attribute.

So i execute this javascript in my transformer:

Code:

var matches = node.toString().match(/(?<=<escape type=")(.+)(?=" \/>)/);
When deploying my channel I get the error:

SyntaxError: Invalid quantifier ?

How can I use my regular expression without getting the error?

Thanks

narupley 02-19-2016 10:37 AM

JavaScript does not support lookbehinds. There are clever ways around it, but you can just use Java regular expressions instead: http://docs.oracle.com/javase/7/docs...x/Pattern.html

batejo 02-22-2016 04:06 AM

Ok, I'll try a workaround then. Thanks


All times are GMT -8. The time now is 01:32 PM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2019, vBulletin Solutions, Inc.
Mirth Corporation