Checking whether a single string is itself a valid URL or not.
URL Regex to ensure URL starts with HTTP/HTTPS:
https?:\/\/(www\.)?[[email protected]:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)
Not require HTTP protocol
[[email protected]:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)
URL Regex JavaScript Examples
HTML example code:
<html>
<body>
<script>
var expression = /[[email protected]:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)?/gi;
var regex = new RegExp(expression);
var tURL = 'www.eyehunts.com';
if (tURL.match(regex)) {
alert("Successful match");
} else {
alert("No match");
}
</script>
</body>
</html>
Output:

Do comment if you have any doubts or suggestions on this JS URL topic.
Note: The All JS Examples codes are tested on the Firefox browser and the Chrome browser.
OS: Windows 10
Code: HTML 5 Version

Degree in Computer Science and Engineer: App Developer and has multiple Programming languages experience. Enthusiasm for technology & like learning technical.