# How to use headerRegex

**URL:** <https://community.gatling.io/t/how-to-use-headerregex/4546>\
**Category:** Gatling (Open-Source)\
**Created:** [October 3, 2018, 10:59am UTC](https://community.gatling.io/t/how-to-use-headerregex/4546 "2018-10-03T10:59:22Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sasmita\_Dash](https://avatars.discourse-cdn.com/v4/letter/s/7ea924/32.png) [@Sasmita\_Dash](https://community.gatling.io/u/Sasmita_Dash)\
**Post date:** [October 3, 2018, 10:59am UTC](https://community.gatling.io/t/how-to-use-headerregex/4546/1 "2018-10-03T10:59:22Z")

</div>

Hi,

I have header response as  
Set-Cookie: APT\_SESSIONID=ZhROCfuCLPecWZHfZXG5GzjDu27CQ0rz\_EncOcqJ.app\_axa; path=/

I need to extract the value “ZhROCfuCLPecWZHfZXG5GzjDu27CQ0rz\_EncOcqJ.app\_axa”.

I tried to use headerRegex as mentioned below. But it is not working for me. Please help.

```auto
 headerRegex("Set-Cookie",""""APT_SESSIONID=(.*?); path=/""").ofType[(String, String)].saveAs("capt_sessionid")

```

```auto

headerRegex("Set-Cookie","""APT_SESSIONID=(.*); path=/""").ofType[(String)].saveAs("capt_sessionid"))

```

```auto

headerRegex("Set-Cookie","capt_sessionid=${APT_SESSIONID}.*"))

```

```auto

```

```auto

```

```auto

```

```auto
Thanks,

```

```auto
Sasmita

```

---

<div class="post-metadata">

**Author:** ![Sasmita\_Dash](https://avatars.discourse-cdn.com/v4/letter/s/7ea924/32.png) [@Sasmita\_Dash](https://community.gatling.io/u/Sasmita_Dash)\
**Post date:** [October 3, 2018, 11:00am UTC](https://community.gatling.io/t/how-to-use-headerregex/4546/2 "2018-10-03T11:00:41Z")

</div>

Please ignore the line as not correct.

```auto
 headerRegex("Set-Cookie",""""APT_SESSIONID=(.*?); path=/""").ofType[(String, String)].saveAs("capt_sessionid")

```

```auto

```

---

<div class="post-metadata">

**Author:** ![Satish\_Kumar\_G](https://avatars.discourse-cdn.com/v4/letter/s/7cd45c/32.png) [@Satish\_Kumar\_G](https://community.gatling.io/u/Satish_Kumar_G)\
**Post date:** [May 9, 2019, 5:22pm UTC](https://community.gatling.io/t/how-to-use-headerregex/4546/3 "2019-05-09T17:22:29Z")

</div>

How did you solve it? I have the same issue
