I want to make a regular expression for my university registration number. I am 75% successful to make it. I’m new and i don’t know how to make it. This is what i am doing.
<!DOCTYPE html>
<html>
<body>
<script>
str = "l1s10bscs"; //successfully tested
//but i want to append any 4 digits at the end of l1s10bscs
re = /[a-zA-Z]\d{1}[s|S|f|F]\d{2}[bscs]/g;
result = re.test(str);
document.write(result);
</script>
</body>
</html>
i tried this but it doesn’t work.
re = /[a-zA-Z]\d{1}[s|S|f|F]\d{2}[bscs][0-9]{4}/g; // this doesn't work
According to your description, this should fit.
I changed the following: