You're running the test against the wrong variable. In the below:
var data1 = /learning+\s+html+/g.test(data1);
You're calling
.test(data1)
which is testing against a variable which doesn't exist yet. You need to pass the
value
variable into this instead:
var data1 = /learning+\s+html+/g.test(value);
The regular expression might not be correct too, but I'm sure you will work this out. There are
online regular expression evaluators[
^] which can help with building the right expression.