# How to get a specific int from the response

**URL:** <https://community.postman.com/t/how-to-get-a-specific-int-from-the-response/41567>\
**Category:** Help Hub\
**Tags:** tests\
**Created:** [November 29, 2022, 9:33am UTC](https://community.postman.com/t/how-to-get-a-specific-int-from-the-response/41567 "2022-11-29T09:33:18Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kyortush\_13](https://avatars.discourse-cdn.com/v4/letter/k/5fc32e/32.png) [@Kyortush\_13](https://community.postman.com/u/Kyortush_13)\
**Post date:** [November 29, 2022, 9:33am UTC](https://community.postman.com/t/how-to-get-a-specific-int-from-the-response/41567/1 "2022-11-29T09:33:18Z")

</div>

{  
“Status”: 0,  
“Message”: “Successfully received 47 items for Folder (Account\_075), File (File\_109) and IsBoolean (False) as expected”,  
“Code”: 0

}

I need to get the int value between " received" and “items” words (in this case it is 47) and set it as a test variable for the following row in my test:

pm.response.to.have.jsonBody(“Message”, “Successfully received… as expected”)

Thanks!!!

---

<div class="post-metadata">

**Author:** ![w4dd325](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/w4dd325/32/12436_2.png) [@w4dd325](https://community.postman.com/u/w4dd325)\
**Post date:** [November 29, 2022, 10:17am UTC](https://community.postman.com/t/how-to-get-a-specific-int-from-the-response/41567/2 "2022-11-29T10:17:27Z")

</div>

Hi @Kyortush_13

Try this;

```auto
var body = responseBody;
var array = new RegExp("Successfully received (.*?) items for Folder").exec(body);
console.log(array[1]);

```

Output;

 ![image](https://us1.discourse-cdn.com/getpostman/original/3X/c/7/c780f7c8e16803bd39084fab5a2cf5a02fb9698b.png)

---

<div class="post-metadata">

**Author:** ![kaliswarannachimuthu](https://avatars.discourse-cdn.com/v4/letter/k/aca169/32.png) [@kaliswarannachimuthu](https://community.postman.com/u/kaliswarannachimuthu)\
**Post date:** [November 29, 2022, 10:05pm UTC](https://community.postman.com/t/how-to-get-a-specific-int-from-the-response/41567/3 "2022-11-29T22:05:58Z")

</div>

You can use the below Regex to get the integer.

```auto
let jsonResponse=pm.response.json();
let message=jsonResponse.Message;

let totalItems=message.replace(/\D/g,'');
console.log(totalItems);

```
