How to iterate date in text file using regular expression
I am trying to iterate the date inside the text file and want to import the file in my application using test complete,
tried using regular expression its not working
For ex:
30/05/2018,09:30,00:25,Slot2,NH New History-2,03,,07,,Comedy,16,,06,,"Host has to offer.",2016,,,ENG,SGGTY5527,,,25,,,,,,,,,,,,1|2|3,30,VOD,E,,,Y
30/05/2018,11:35,00:25,Slot1,NH New History-1,03,,07,,Comedy,18,,F,,"Host has to offer.",2016,,,ENG,SGGYT5127,,,25,,,,,,,,,,,,1|2|3,15,VOD,M,,,N
30/05/2018,14:30,00:25,Slot3,NH New History-3,03,,07,,Comedy,16,,06,,"Host has to offer.",2016,,,ENG,SGYGT5627,,,25,,,,,,,,,,,,1|2|3,30,VOD,,,,
in the above text the date should get replaced by 30/05/2019 for all occurrences .
The code i tried :
s = "Some 20/04/2021 ex 2021/02/21 dfsdkjfdksajsda"
var re =/^(0?[1-9]|[12][0-9]|3[01])[\/](0?[1-9]|1[012])[\/\-]\d{4}$/g;
var m;
while (m = re.exec(s)) {
var myDate=new Date(m)
myDate.setFullYear(myDate.getFullYear() + 1);
a=s.replace(m,myDate.toLocaleDateString())
alert(a);
}