I am trying to use regex to validate a form in js, but I encountered a problem, which I could no google successfully.
When I create any RegExp in js, for example with the /(.)*/ the test function returns false no matter on what I test it... In php and regex online editors it works fine.
I tried to google it, but without any success, it seems as everyone is using the:
var regexp = /expression/
My code:
var reg = new RegExp("/(.)+/", "g");
console.log("Regexp:" + reg.test("a"));
Also I have been told that the regex in php should be compatible with the regex in js...