I have an input text where user can write string. I want to have an regular expression in javascript which check if the string starts with three characters FSM. If the user write another string which doesn't start with FSM, this string was automatically remove and give the error message
Example:
- FSMLERTE True
- FSMAMAMA True
- SFMABNE false et remove this content in the input
I do this but it's doesn't work
var input22Regex= /^[a-z]$/;
if(inputtxt.value.match(inputRegex)) {
return true;
} else {
inputtxt.value = '';
alert("String must start with FSM");
return false;
any idea ?