URL Extractor

URL Extractor is a tool for extracting URLs out of text. It is based on regular expressions.


URL Extractor

You can use it to extract URLs from plain text, HTML pages, emails, RSS feeds, newsgroups posts, etc. There are many improvements over the original version including faster extraction speeds, better error handling, and improved Unicode support. The program now extracts both HTTP and HTTPS URLs. You can configure the maximum number of URLs per page. And finally, if you wish, you can specify a different encoding than UTF-8 (such as ISO-8859-1).

URL Extractor realization using regular expression

Regular expression is a way of describing patterns in strings of characters. A regular expression consists of two parts: a pattern and a replacement string.

The pattern describes what character sequences to match. In general, a regular expression looks like this: /pattern/replacement/.

For example, the following regular expression matches any sequence of digits (0-9) followed by a period (.) at the end of a line: /\d\.$/

The replacement string tells the program how to replace each matched portion of the input string. For example, the above regular expression could be replaced by simply the number 1.

You can use the following command to test if a given string contains a valid URL:

This command uses the following options:

- r : Read file

- e : Extract URLs

- -r `: Read file

- -e ``: Extract URLs

Example using regular expression to verify URL in a string

<h2>JavaScript Regular Expression</h2>

<p>Do a search for URL in a string:</p>

<p id="demo"></p>

<script>
    let result = "False";
    let text = "Visit https://google.com";
    let pattern = /(?:https?)://(\w+:?\w*)?(\S+)(:\d+)?(/|/([\w#!:.?+=&%!\-/]))?/;
    if (text.match(pattern)) result = "True";
    document.getElementById("demo").innerHTML = result;
</script>

Check Our Email Validation Tool

email letter
Email letter

Related Tools

Contact

Missing something?

Feel free to request missing tools or give some feedback using our contact form.

Contact Us