<html>
<body>
<p>A form with a search field that CANNOT contain the following characters: ' or "</p>
<form action="https://www.w3schools.com/action_page.php">
Search: <input type="search" id="mySearch" name="search" pattern="[^'\x22]+" title="Invalid input">
<input type="submit">
</form>
<p>Click the "Try it" button to display the value of the pattern attribute of the search field.</p>
<button onclick="myFunction()">Try it</button>
<p id="demo"></p>
<script>
function myFunction() {
var x = document.getElementById("mySearch").pattern;
document.getElementById("demo").innerHTML = x;
}
</script>
</body>
<!-- Mirrored from www.w3schools.com/jsref/tryit.asp?filename=tryjsref_search_pattern by HTTrack Website Copier/3.x [XR&CO'2014], Mon, 27 Jan 2020 03:17:19 GMT -->
</html>