var regEx = new RegExp("/[0-9]/");
var test = 'TREE'
alert(test.match(regEx));
or
var regEx = new RegExp("/[0-9]/");
var test = '1234'
alert(test.match(regEx));
Why do they return null?
Am i missing something here?
(Ok, the debate mentally drained me last night)
When you are using
new RegExp, you don’t need the delimiters (/).You only need the slashes if you are using a regex literal (which I prefer using to
new RegExp).