On 8/19/2016 5:52 AM, Mike Brudenell wrote:
I think I've got a workaround by using *sg* to look for the final <…> (if
there is one) in the value of $h_from: and stripping off everything before
it:
${domain:${sg {$h_from:} {^.*<([^<]*)> *\$} {\$1}}}
I agree sg is the right approach. You can't really depend on anything
being per spec.
I didn't understand the purpose of the fragment '[^<]' in your pattern.
Possibly I just haven't written enough regex for exim.
I would tend to write something like
${sg {$h_from:} {^\N(.*)?\<(.*)?\>$\N} {[D1]\$1[D2]\$2}}'
This makes use of patterned substitution strings to allow for easier
parsing of the actual case, and \N to avoid expansions.
[~]#exim -be '${sg {[email protected]} {^\N(.*)?\<(.*)?\>$\N}
{[D1]\$1[D2]\$2}}'
[email protected]
[~]#exim -be '${sg {<[email protected]>} {^\N(.*)?\<(.*)?\>$\N}
{[D1]\$1[D2]\$2}}'
[D1][D2][email protected]
[~]#exim -be '${sg {[email protected] <[email protected]>}
{^\N(.*)?\<(.*)?\>$\N} {[D1]\$1[D2]\$2}}'
[D1][email protected] [D2][email protected]
[~]#exim -be '${sg {"george peabody" <[email protected]>}
{^\N(.*)?\<(.*)?\>$\N} {[D1]\$1[D2]\$2}}'
[D1]"george peabody" [D2][email protected]
- Phil Carroll
--
## List details at https://lists.exim.org/mailman/listinfo/exim-users
## Exim details at http://www.exim.org/
## Please use the Wiki with this list - http://wiki.exim.org/