Look at the source, this is an example of using regex class in html

when the input is incorrect the border is red

try some regex patterns via the console

/[0-9]/.test("in 1992") // → true
/^[0-9]/.test("in 1992") // → false
/[0-9]$/.test("in 1992") // → true
/^[0-9]$/.test("in 1992") // → false
/^[0-9]+$/.test(1992) // → true
/^[0-9]{4}$/.test(199) // → false

let pattern = /ab|cd/
pattern.test("nothing to see here")
pattern.test("nothing ab to see here")
pattern.test("nothing to see cd here")
pat = RegExp('lin|win')
pat.test("best OS is linux")