1

So I have this small script that uses getPlainBody() to get the message body of a GmailApp thread, that part is fine and working. Somewhere inside that body is a URL, let's say "http://www.aohell.com/tacofriedrice"

Is it possible to have a script find and pull that entire link just by searching for part of it?

For example, I want the script to search the message body for "http://www.aohell.com" and if it finds that match, it will pull the rest of the URL "http://www.aohell.com/tacofriedrice" and save it to a variable.

I had found a method ".findText("http://.*/")" while looking around existing posts, but findText doesn't appear to actually be an existing google apps function according to the error message. Afterwards what I found suggests to use .getElement().asText().getText() but I've got no idea if those will work either since findText() doesn't.

Moreroo
  • 11
  • 1
  • Sounds possible give it a try. – Cooper Feb 21 '19 at 04:34
  • This might be duplicate of [https://stackoverflow.com/q/2343177/7215091](https://stackoverflow.com/q/2343177/7215091) – Cooper Feb 21 '19 at 04:46
  • Possible duplicate of [regex for URL including query string](https://stackoverflow.com/questions/2343177/regex-for-url-including-query-string) – Cooper Feb 21 '19 at 05:55

0 Answers0