I'm having problems to define a regex in javascript. I want to replace format strings in this format (i.e. "dd/mm/yy") by strings in this other format (i.e. "dd/MM/yyyy"). My problem is how to use javascript regex. For instance, how to convert the year? I've been trying to convert with these expressions:
f1 = "dd/mm/yy";
f1 = f1.replace(/[^y](yy)[^y]/g, 'yyyy');
f1 = f1.replace(/[^y](y)[^y]/g, 'yy');
With this I attempted to convert all 'yy' not sorrounded by any 'y' to 'yyyy' and then do the same with alone 'y', but I don't know how to say "yy not sorrounded by any y".