I have this code that works.
myDate = str.match(/(\d{1,4}([.\-/])\d{1,2}([.\-/])\d{1,4})/g);
However I would like to store the expression as a variable and use that instead. Something like this:
pattern = "/(\d{1,4}([.\-/])\d{1,2}([.\-/])\d{1,4})/g"; // I understand this is wrong somehow
myDate = str.match(pattern);
How do I store my expression as a variable and use it the way I have shown?
Thanks in advance.