I am working on matching the name for eg. name in the response says:
'World map'
Now I want to write a generic regex in the karate jsonpath which should work for the word "map" irrespective of its position in the multiple words for eg - One common script should match below permutations.
1 - Climate map 2 - Wolds map 3 - Worlds China map 4 - Big map is too small 5 - Big map is there
What I have written so far, which seems to be not working
$..source..[?(@.name =~ /(\bmap\b)/i)]
Can anyone please help what exact regex should I put which would check 'map' world in the example above.
Sometimes it is simpler to use pure Java:
* def str = 'foo map bar'
* assert str.contains('map')
* def hasMap = function(x){ return x.contains('map') }
* assert hasMap(str)
So don't use a regex, please refer this part of the docs: https://github.com/intuit/karate#self-validation-expressions