View Single Post
Old 16 Jan 2019, 01:01 PM   #4
xyzzy
Essential Contributor
 
Join Date: May 2018
Posts: 474
Problem solved. What I was forgetting is that match variables for regex's correspond to parenthesized terms within the regex expression. In the expression I wrote I was after what the .* matched. So it should have been written as (.*). Once I did that I could see what the .* was matching.

It turns out that a From: with a non-blank name without enclosing quotes was sucking up the space between the end of the name and the < introducing the email address. The fix was to turn the * into a "lazy *", i.e., .*?. So the final test expression is:

Code:
header :regex "From" "(^|,)[[:space:]]*\"?(.*?)\"?[[:space:]]*<"
and ${2} contains the name.
xyzzy is offline   Reply With Quote