How to mark end of the row when using match() function? From this page I need to pull out “2021 JANUARY 18 MONDAY”
When somethng exists after desired string I’ve used this code:
var page = UrlFetchApp.fetch(link).getContentText(); var date = page.match(/results of (.*?)SOMETHING/m)[1];
but now I can’t
Advertisement
Answer
Here’s how that date format can be matched in a string:
var string = "lorem ipsum 2021 January 18 Monday"; var date = string.match(/(d{4} [A-z]+ d{1,2} [A-z]+)/)[0] || null; console.log(date);