Pattern for validating a text area, to allow all characters except those in the regex pattern. An event listener checks entry on keyup, and displays error or success live in the bootstrap 5 HTML.
if (field.name === "form_message") {
const re = /[#%^&*\][}{=+\\|><\`~]/;
if (re.test(field.value)) {
let msgString = field.value;
let match = msgString.match(re)
this.setStatus(field, `Character '${match}' is not allowed`, "error")
} else {
this.setStatus(field, null, "success")
}