If we have the following string:
"hukhkhk\nClosing Date: Friday 22nd April 2022\nwdwqdwqdwqd\nClosing Date: Friday 22nd April 2023\newdewfewf"
and we want to get the 2 dates from it "Friday 22nd April 2022"
and "Friday 22nd April 2023"
how do I go about getting an array back of all captured strings using js.
[ "Friday 22nd April 2022", "Friday 22nd April 2023" ]
There is an issue in my regex but not sure how to fix it so that it doesn't match everything in between the first \n
it finds:
(?<=Closing Date:\s)(.*)(?=\\n)
The js I tried is this:
var reg = new RegExp('(?<=Closing Date: )(.*)(?=\\n)/g');
reg.exec("hukhkhk\nClosing Date: Friday 22nd April 2022\nwdwqdwqdwqd\nClosing Date: Friday 22nd April 2023\newdewfewf")