# Jsonpath and Regex

**URL:** <https://community.gatling.io/t/jsonpath-and-regex/3893>\
**Category:** Gatling (Open-Source)\
**Created:** [August 21, 2017, 4:25pm UTC](https://community.gatling.io/t/jsonpath-and-regex/3893 "2017-08-21T16:25:27Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Cedric\_Cazin](https://avatars.discourse-cdn.com/v4/letter/c/7feea3/32.png) [@Cedric\_Cazin](https://community.gatling.io/u/Cedric_Cazin)\
**Post date:** [August 21, 2017, 4:25pm UTC](https://community.gatling.io/t/jsonpath-and-regex/3893/1 "2017-08-21T16:25:27Z")

</div>

Hello

Considering the “store book” json present on [https://github.com/json-path/JsonPath](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 🙂

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

---

<div class="post-metadata">

**Author:** ![Donovan\_Eastes](https://avatars.discourse-cdn.com/v4/letter/d/22d042/32.png) [@Donovan\_Eastes](https://community.gatling.io/u/Donovan_Eastes)\
**Post date:** [August 22, 2017, 1:41pm UTC](https://community.gatling.io/t/jsonpath-and-regex/3893/2 "2017-08-22T13:41:52Z")

</div>

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/](http://gatling.io/docs/current/http/http_check/)

Hope this helps.

Don

---

<div class="post-metadata">

**Author:** ![Cedric\_Cazin](https://avatars.discourse-cdn.com/v4/letter/c/7feea3/32.png) [@Cedric\_Cazin](https://community.gatling.io/u/Cedric_Cazin)\
**Post date:** [August 22, 2017, 3:32pm UTC](https://community.gatling.io/t/jsonpath-and-regex/3893/3 "2017-08-22T15:32:10Z")

</div>

Thanks  
will do
