Free Link Extractor Tool Online

This tool will extract link from any bulk text into line by line separated text,

Free tool link here,

Code:

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Extract Links</title>
</head>
<body>

<textarea id="inputText" rows="4" cols="50"></textarea><br>
<button onclick="extractLinks()">Extract Links</button><br>
<textarea id="outputText" rows="4" cols="50" readonly></textarea>

<script>
function extractLinks() {
var inputText = document.getElementById("inputText").value;
var regex = /(?:https?|ftp):\/\/[\n\S]+/g;
var matches = inputText.match(regex);
var outputText = "";
if (matches) {
for (var i = 0; i < matches.length; i++) {
outputText += matches[i] + "\n";
}
}
document.getElementById("outputText").value = outputText;
}
</script>

</body>
</html>

Explanation of code basic concept:

This HTML code creates a simple web page with a textarea for input, a button to trigger the extraction of links from the input text, and another textarea to display the extracted links. Here's what each part of the code does:

  1. The textarea element with the id "inputText" is used for inputting the text containing links.
  2. The button element with the onclick attribute set to "extractLinks()" triggers the extractLinks function when clicked.
  3. Another textarea element with the id "outputText" is used to display the extracted links.
  4. Inside the script tag, the extractLinks function is defined. This function does the following:
    • It retrieves the input text from the textarea with the id "inputText".
    • It defines a regular expression (regex) to match URLs. This regex matches URLs starting with "http", "https", or "ftp".
    • It uses the match method with the regex to find all matches of URLs in the input text.
    • It iterates over the matches found and appends each match followed by a newline character to the outputText variable.
    • Finally, it sets the value of the textarea with the id "outputText" to the outputText, effectively displaying the extracted links.

So, when you input text containing URLs into the first textarea and click the "Extract Links" button, the script will find all URLs in the input text and display them line by line in the second textarea.

Leave a Reply

Your email address will not be published. Required fields are marked *