get-first-url-from-string

Return the 1st url in a given input text

Usage no npm install needed!

<script type="module">
  import getFirstUrlFromString from 'https://cdn.skypack.dev/get-first-url-from-string';
</script>

README

get-first-url-from-string

Import the function, pass in a string.

The response will always be a string, either containing the 1st HTTPS URL it found or just an empty string.

No dependencies, see an improvement on the regex pattern, PRs are welcomed :)

For examples, please see the unit tests.