> ## Documentation Index
> Fetch the complete documentation index at: https://baileys.wiki/llms.txt
> Use this file to discover all available pages before exploring further.

# extractUrlFromText

> Uses a regex to test whether the string contains a URL, and returns the URL if it does.

> **extractUrlFromText**(`text`): `undefined` | `string`

Defined in: [src/Utils/messages.ts:90](https://github.com/WhiskeySockets/Baileys/blob/master/src/Utils/messages.ts#L90)

Uses a regex to test whether the string contains a URL, and returns the URL if it does.

## Parameters

### text

`string`

eg. hello [https://google.com](https://google.com)

## Returns

`undefined` | `string`

the URL, eg. [https://google.com](https://google.com)
