Find string in mail message source using regex

Easy enough, or so I thought.

I’m using AppleScript to pull the source of a mail message into a variable called theSource. I’m able to put this source into the clipboard and paste its contents in a text doc, which shows me that the formatting is good.

Now I want to use regex to search that source and return any matches. Here’s the regex:

(?<=>)Ref:.*?(?=<)

The first match should be set as the clipboard. After a few hours, I’m nowhere. So I thought I’d post here.

Thanks!

CJ