# Need to get the full https url from response body and click it

**URL:** <https://community.postman.com/t/need-to-get-the-full-https-url-from-response-body-and-click-it/64442>\
**Category:** Help Hub\
**Tags:** html-response\
**Created:** [July 23, 2024, 1:03am UTC](https://community.postman.com/t/need-to-get-the-full-https-url-from-response-body-and-click-it/64442 "2024-07-23T01:03:43Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![anita.christobel](https://avatars.discourse-cdn.com/v4/letter/a/e19b73/32.png) [@anita.christobel](https://community.postman.com/u/anita.christobel)\
**Post date:** [July 23, 2024, 1:03am UTC](https://community.postman.com/t/need-to-get-the-full-https-url-from-response-body-and-click-it/64442/1 "2024-07-23T01:03:43Z")

</div>

I am trying to get the full url value from response and click on the link to verify the email

my response

```auto
{
    "messages": [
        {
            "messageId": "1",
            "date": "Tue, 23 Jul 2024 00:44:19 +0000",
            "from": "test@mail.com",
            "to": [
                "sample@mail.com"
            ],
            "subject": "Activation Link",
            "body": "Dear XXX,\n\n you need to verify your email address. Please enter the verification link . This link will be valid for five minutes.\n\nHere is your verificationLink: https://sample.com/verifyEmail?emailCode=IDpCK5%2FagNDdtCxss15Tm%2FKuhOs6q%2FwcjWVVXgLsQzX7TcXU593%2Bxz3LnW9GKgQdRKlPybNppHfJJ8hFewg0OvmRL26h1y%2BMFNlng2am6yFSw1IJ1gFNns5LfDYfQKn2WqJbujoFrnPCUwrAzdAacxGNNpmAGqUU4UiWbvWRw9C8C2IPItPd91AfDL4L5FPH8Bsox3g3Lbolg%2F98S80DIa2ysICav4ozf52al5lDfmSrR3kSV0SJB8J0lL8B5dfDeCPVyrmZMsA5x245hwrFHW9CrUuXLKwOJ%2FUMXJ2nd1Ul6i9%2F6%2BGYbtzPu8qXA%2B%2BImERt4eAfP4DsobbnOaPInDuP%2B7YSChONJ7dHRLN2Bz3Cl6qmZy6NtybqPI3mQB8vdMBN8QrMpl%2B2FLIxyLdtPbKFGYEulzRKwebKvyMJpjvFdOSU2EznC7ZAGqlFPtdu7JsD%2FIhOFZmNnBvkAXCAaeFH7GfDSY%2F9Pi8FMPHgP5QZHkZ6MaWBRwulO%2FspWOv2\n\nSincerely,\n*\n\nThis is an automated message, please do not reply."
        }
    ]
}

```

What i am trying to do in the code

```auto
let body = response.messages[0].body
        let authCode = body.match(/https:/g); 
        console.log("Link :: "+authCode)

```

it only retrieves only “https” . but i need the full url and click on that url.Please help

---

<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:** [July 23, 2024, 10:15am UTC](https://community.postman.com/t/need-to-get-the-full-https-url-from-response-body-and-click-it/64442/2 "2024-07-23T10:15:36Z")

</div>

Hey @anita.christobel 👋

Your regex would need to look something like this to get the full URL:

```auto
let body = response.messages[0].body
let authCode = body.match(/(https?:\/\/[^\s]+)/g); 
console.log("Link :: " + authCode[0])

```

The `.match()` would also return an array so you would been to access the first item using `[0]`.

That would only log that out in the console, you wouldn’t be able to click on it to verify anything from there.

---

<div class="post-metadata">

**Author:** ![michaelderekjones](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/michaelderekjones/32/14819_2.png) [@michaelderekjones](https://community.postman.com/u/michaelderekjones)\
**Post date:** [July 23, 2024, 1:00pm UTC](https://community.postman.com/t/need-to-get-the-full-https-url-from-response-body-and-click-it/64442/3 "2024-07-23T13:00:25Z")

</div>

What do you mean by “click it”?

Depending on the API that is serving that email verficiation service, you might be able to setup a standard GET request to the retreived URL, or an sendRequest() function in a script.

However, there may be protections on the API that block non browser requests, so it will be a case of try it and see what happens.

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/system/32/29796_2.png) [@system](https://community.postman.com/u/system)\
**Post date:** [August 22, 2024, 1:01pm UTC](https://community.postman.com/t/need-to-get-the-full-https-url-from-response-body-and-click-it/64442/4 "2024-08-22T13:01:12Z")

</div>

Closed on August 22, 2024, 1:01pm UTC

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
