I want to extract an address (if it occurs) fr om a To: list. For example, if "XXX@fred.com" occurs, I want to extract it. I can use a regex to see if "@fred.com" is there, but than, how do I find the "XXX", given that I have no idea wh ere the address occurs in the list, and I can't see any looping macro to move down the list one address at a time.
It may take some trial and error, but I think regex might do it if you set a limit on how many characters might precede the @ and know what delimiter might separate email ids. Regex has a few operands for unknown characters, so I'd give it a try. I've used regex on onccasion, but I'm no guru. Good luck. And the suggestion may be useless, but it would be my first approach. david
I think I've worked something out, but am now having trouble with subpatterns.
(?i)\s*([^,;]*@fred\.com[^,]*)[,;$]? picks up everything between the address delimiters which as far as I can see should be comma or semi-colons and does case-insensitive matching.
But when I try to pick up the address part (the subpattern between the brackets) %SUBPATT="1" gives me a blank string. Using a regex tester it works OK, so the problem is obviously in my understanding of The Bat's contorted macro syntax. Any ideas? My brain hurts.