I am going to make a function that returns a value equal to the first match.The RegEX implementation in WSH/ASP is capable of creating an object containing a set of matches that can be iterated through. While this is powerful, it is not what I want to do for the first demonstration. Instead, I am going to make a function that returns a value equal to the first match. I have a real-world example in mind. The email notifications that go out on Scala discussions contain a discussion link that leads sales prospects back to their personal discussion with Scala. These discussions take place in a web-based Message Board system. We encourage people to follow these links back, but on occasion, people reply directly to the notification. I will be building the system that takes these replies, and automatically posts it back into their discussion, saving lots of manual time of visiting the discussion ourselves and copying & pasting the message back into place.
What I need to do is extract the message ID from the body of the Email message.Most of this project, you will not be seeing. I will be focusing on only the function containing the RegEX. The function will take the body of the email message as input and return the message ID. So, what I need to do is extract the message ID from the body of the Email message. The message ID appears in a URL in the body of the message. There are other approaches to doing this involving using a combination of VBScript's string processing functions, like InStr(), Replace() or Mid() or Left(). But I can do it in one shot with RegEX. This is a perfect example. |