Skip to content Skip to sidebar Skip to footer

Google App Script Regex Exec() Returns Null Only In One Function

I am writing a Google Apps script to create a calendar event based on automated emails I receive for jobs. I am using regex expressions to extract information that I need to popula

Solution 1:

The pattern you're using seems overly complicated. I can't say for sure what's causing it to fail, but my guess would be the (\r|\n) at the end (note that you can just type [\r\n] instead if you really want to do this).

Give this pattern a try:

Substitute Report Times:.+ - (\d{1,2}:\d{1,2} [AP]M)

This assumes that the end time is always preceded by a hyphen and a space, which looks to be the case from the sample text you provided.

Post a Comment for "Google App Script Regex Exec() Returns Null Only In One Function"