Stream: implementers
Topic: Forge FHIRPath Expression Error
Noemi Deppenwiese (Jun 19 2019 at 14:55):
I'm trying to add a constraint on the value field of an identifier slice (sliced by system). I want to use the "matches" function and a regular expression to validate the identifier value, but Forge tells me: Invalid FHIR path expression: Compilation failed: Parsing failure: unexpected '('; expected end of input (Line 1, Column 8); recently consumed: matches
Severity: Warning
Source : Expression
Context : [Biobank] Organization.identifier:Bbmri-EricId.value::constraint<bbmri-id-1>.expression
regex.png
I'm unable to find the error in my FHIRPath, can anyone help me?
Lloyd McKenzie (Jun 19 2019 at 15:57):
@Michel Rutten ?
Brian Postlethwaite (Jun 20 2019 at 07:11):
Can you paste the expression here and I'll check it over.
Michel Rutten (Jun 20 2019 at 10:14):
Forge tries to verify the syntax of FHIR path expressions, using the FHIRPath parser in the API. I'm not sure why the parser trips on this specific expression. @Brian Postlethwaite may be able to explain?
Noemi Deppenwiese (Jun 21 2019 at 08:32):
@Brian Postlethwaite
Can you paste the expression here and I'll check it over.
matches('^([a-z]){2}_([a-zA-Z\d])+$')
I'm not sure if it's my FHIRPath expression or an error in the API.
Brian Postlethwaite (Jun 24 2019 at 04:16):
The \ needs to be delimitted
matches('^([a-z]){2}_([a-zA-Z\\d])+$')
see
http://hl7.org/fhirpath/2018Sep/index.html#replacematchesregex-string-substitution-string-string
Glad Forge picks this one up :wink: an easy one to make and easily missed.
(one of the reasons that I did that validation code in the fhirpathtester tool, and contributed it to Forge)
Noemi Deppenwiese (Jun 24 2019 at 08:32):
Thank you!
Last updated: Apr 12 2022 at 19:14 UTC