web stats
Invalid quantifier ? when using Lookbehind regex - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #1  
Old 02-19-2016, 10:26 AM
batejo batejo is offline
What's HL7?
 
Join Date: Feb 2016
Posts: 3
batejo is on a distinguished road
Default 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
Reply With Quote
  #2  
Old 02-19-2016, 10:37 AM
narupley's Avatar
narupley narupley is online now
Mirth Employee
 
Join Date: Oct 2010
Posts: 7,119
narupley is on a distinguished road
Default

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
__________________
Step 1: JAVA CACHE...DID YOU CLEAR ...wait, ding dong the witch is dead?

Nicholas Rupley
Work: 949-237-6069
Always include what Mirth Connect version you're working with. Also include (if applicable) the code you're using and full stacktraces for errors (use CODE tags). Posting your entire channel is helpful as well; make sure to scrub any PHI/passwords first.


- How do I foo?
- You just bar.
Reply With Quote
  #3  
Old 02-22-2016, 04:06 AM
batejo batejo is offline
What's HL7?
 
Join Date: Feb 2016
Posts: 3
batejo is on a distinguished road
Default

Ok, I'll try a workaround then. Thanks
Reply With Quote
Reply

Tags
javascript, regexp, transformer

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -8. The time now is 03:47 PM.


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