How to modify a regular expression to validate a text box with letters and numbers only, excluding certain characters like !@#$%^&*+=
The regulation expression you are currently using is for validate email addresses.
So you have to use a regular expression to validate textboxes, make it only contain letters and numbers and avoid the characters (!@#$%^&*+=).
^[a-zA-Z0-9]+$

This will match any strings that is a letter or a number. It will not match any strings that any characters !@#$%^&*+=.


<input type="text" pattern="^[a-zA-Z0-9]+$" />



Hope this will help. Thank you!
Refer to this link if you need more clarifications https://laasyasettyblog.hashnode.dev/validating-username-using-regex
Improving my answer with the question u asked,


<!DOCTYPE html>
<html>
<head>
<title>Test Pattern</title>
</head>
<body>
<input type="text" id="input" pattern='^[a-zA-Z0-9./|()?~<>":;]+$' />
<button onclick="validate()">Validate</button>
<script>
function validate() {
 var input = document.getElementById("input").value;
 var pattern = /[a-zA-Z0-9./|()?~<>":;]+/;
 if (pattern.test(input)) {
  alert("Valid");
 } else {
  alert("Invalid");
 }
}
</script>
</body>
</html>




Regular Expression for text box validation. I need to validate textbox. conditions like below

can enter numbers and letters.
need to avoid these characters !@#$%^&*+=

Currently i am using below regular expression. but it is not working.
 <input type="text" pattern="^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$" />
can u help me to find correct regular expression
