Google Scripts match regex

Viewed 19817

Using google scripts I'm trying to match a string part that always looks like this: *YYYYMMDD;hhmm* for example: *20170701;0900*

I defined this regex:

var regExp = ('(?:\*)(?P<date>\d+)(?:\;)(?P<time>\d+)(?:\*)','gi');

and then call it using:

var datepart = textbody.match(regExp);

However I'm not getting any match, although the same text in https://regex101.com/ works well. Any idea what I'm doing wrong?

1 Answers
Related