Forum Discussion

hollingl's avatar
hollingl
Occasional Contributor
8 years ago

JSONPath expression including a filter that uses a RegExp

I am struggling to find out if/how SoapUI supports a JSONPath filter expression that includes a RegExp. I have tried a variety of syntaxes from various JSONPath implementations, and can't find one that works.

 

Given this JSON payload:

 

{ "content" : [ {"id":1, "label":"Lee"}, {"id":2, "label":"Sam" } ] }

 

I'd like a filter expression that finds elements whose name contains an 'e'. None of the following expressions seem to work:

 

content[?(@.label =~ /e/)]

content[?(@.label =~ /.*e.*/)]

content[?(/e/.test(@.label)] 

content[?(/.*e.*/.test(@.label)]

 

I am on SoapUI OS 5.2.1 on Windows 10.