# HTML Regex / Find

**URL:** <https://community.postman.com/t/html-regex-find/14702>\
**Category:** Help Hub\
**Created:** [August 4, 2020, 10:26am UTC](https://community.postman.com/t/html-regex-find/14702 "2020-08-04T10:26:10Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![JBird20](https://avatars.discourse-cdn.com/v4/letter/j/3d9bf3/32.png) [@JBird20](https://community.postman.com/u/JBird20)\
**Post date:** [August 4, 2020, 10:26am UTC](https://community.postman.com/t/html-regex-find/14702/1 "2020-08-04T10:26:10Z")

</div>

Hi All,

I have done some googling, and reviewed the help section here, and i’ve come up blank.

I have a HTML response body that looks like this:

```
<div id="aws_footer">

                                <div id="aws_footer_button_container">

                                    <div class="button_container button-secci-container marginBottom15">

                                        <button onclick="openDocEnableButtonAndCapturePR('contract1_035f892c-ccb8-4576-b69f-9a2b032baf33_copy','true','contract', 'FAagreementMessage','0');return false;" class="button nullbutton" type="button" id="print">Print/view documents<span>Documents will open in a new tab</span></button>

                                    </div>

```

I am trying to extract only: contract1\_035f892c-ccb8-4576-b69f-9a2b032baf33\_copy

can anyone help please

---

<div class="post-metadata">

**Author:** ![JBird20](https://avatars.discourse-cdn.com/v4/letter/j/3d9bf3/32.png) [@JBird20](https://community.postman.com/u/JBird20)\
**Post date:** [August 4, 2020, 10:50am UTC](https://community.postman.com/t/html-regex-find/14702/2 "2020-08-04T10:50:34Z")

</div>

I can do :

var html = cheerio(responseBody);

console.log(html)

However, the array is so big, when i try to search through in Postman, it crashes the console.

---

<div class="post-metadata">

**Author:** ![danny-dainton](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/danny-dainton/32/29401_2.png) [@danny-dainton](https://community.postman.com/u/danny-dainton)\
**Post date:** [August 4, 2020, 10:59am UTC](https://community.postman.com/t/html-regex-find/14702/3 "2020-08-04T10:59:39Z")

</div>

This is only based on your example html but I’m guessing that there’s more on that page so it might not work.

A very hacky and hardcoded way could be:

```auto
const $ = cheerio.load(pm.response.text())

let str = $('button').attr('onclick')

console.log(str.substr(33, 51))

```

---

<div class="post-metadata">

**Author:** ![JBird20](https://avatars.discourse-cdn.com/v4/letter/j/3d9bf3/32.png) [@JBird20](https://community.postman.com/u/JBird20)\
**Post date:** [August 4, 2020, 12:25pm UTC](https://community.postman.com/t/html-regex-find/14702/4 "2020-08-04T12:25:04Z")

</div>

> [@danny-dainton](#):
>
> ```auto
> const $ = cheerio.load(pm.response.text())
> 
> let str = $('button').attr('onclick')
> 
> console.log(str.substr(33, 51))
> 
> ```

It maybe hacky! but it 100% did the job! thank you so much for your help!

---

<div class="post-metadata">

**Author:** ![JBird20](https://avatars.discourse-cdn.com/v4/letter/j/3d9bf3/32.png) [@JBird20](https://community.postman.com/u/JBird20)\
**Post date:** [August 12, 2020, 2:51pm UTC](https://community.postman.com/t/html-regex-find/14702/8 "2020-08-12T14:51:54Z")

</div>

Hi @danny-dainton, could you help me out with another regex issue i am having please?

I need to pull this out from here:

 ![image](https://us1.discourse-cdn.com/getpostman/original/2X/3/357ec7094b7f4362be1110b1b63b3d0606783c2c.png)

but i keep getting undefined…

```
const $ = cheerio.load(pm.response.text())

    let respondEntityId2 = $('Respond.CaseInfo.FormId').value;

    console.log(respondEntityId2);
```
