<!DOCTYPE html>
<html>
<body>
<form action="/action_page.php">
Facebook profile: <input type="url" id="myURL" name="fb">
<input type="submit">
</form>
<p>Click the "Try it" button to specify a regular expression that the URL field's value will be checked against. Note that we also set the "title" to describe the pattern.</p>
<button onclick="myFunction()">Try it</button>
<p id="demo"></p>
<script>
function myFunction() {
document.getElementById("myURL").pattern =
"http://www\.facebook\.com\/(.+)|https://www\.facebook\.com\/(.+)";
document.getElementById("myURL").title =
"URL must start with http://www.facebook.com/";
document.getElementById("demo").innerHTML =
"The URL field now only accept URL's that start with http://www.facebook.com/ or https://www.facebook.com/.";
}
</script>
</body>
</html>