| Home | Notes | Github |
|---|
if Statementsif (true){
console.log("Yay")
} else {
console.log("Nay")
}Courtesy of stack exchange ofc
var term = "sample1";
var re = new RegExp("^([a-z0-9]{5,})$");
if (re.test(term)) {
console.log("Valid");
} else {
console.log("Invalid");
}Remember to escape all of your back slashes (i.e. to match a digit use \\d ).
This is more html but here’s how to have an input field with only positive numbers (courtesy of [this link])