I have used a regex function on a textbox, but it's not working.
<input name="title" class="txtbxinput" id="title"
onblur="showsongstatus(this.value);title(this);"
onkeyup="title(this);" size="58" >
function title(f) {
f.value = f.value.replace(/[^a-zA-Z\s.'-]/gixsm,'');
f.value = f.value.replace(/\s\s+/g, '\s'); //remove more than 2 white spaces.
f.value = f.value.replace(/'{2,}/g, '\'');
f.value = f.value.replace(/--/g, '-');
f.value = f.value.replace(/\.\./g, '\.');
return f;
}
I have restricted it for alphabets, hyphen, dots, and single quotes.