Jsonpath and Regex

Hello

Considering the “store book” json present on https://github.com/json-path/JsonPath

It suggest we can use =~ to regex the name of an author : $…book[?(@.author =~ /.*REES/i)]

Since I need to do something like this with gatling, I tried :slight_smile:

jsonPath($[?(@.username=~/.TESTUSER/i)]._id).findAll.saveAs(“userToDelete”)

18:22:37.009 [WARN ] i.g.h.a.ResponseProcessor - Request ‘get all User’ failed: jsonPath($[?(@.username=~/.TESTUSER/i)]._id).findAll.exists failed, could not extract: could not extract : )]' expected but =’ found

I check in the GitHub of Gatling, and it look like I cannot use =~

Am I wrong ?

Can I do something to get the users I want ?

Regards

Hi,

Try using the regex() function instead of jsonPath(). Some info on the function can be found here: http://gatling.io/docs/current/http/http_check/

Hope this helps.

Don

Thanks
will do