Re: [exim] Regex Parsing help

Góra strony
Delete this message
Reply to this message
Autor: Marc Perkel
Data:  
Dla: exim-users
Temat: Re: [exim] Regex Parsing help


Eli wrote:
>> set acl_c_domain_list = domain1.com domain2.com domain3.com
>>
>> The delimiter is a space but I can make it anything. What I want to do
>> is set two variables. The first variable will have the first domain in
>> the list, no spaces, (domain1.com) and the second variable will have
>> the rest of the list items, no leading space. (domain2.com domain3.com
>> )
>>
>
> man regex - even the POSIX explanation, after reading it through a few
> times, will help you understand the basics of regular expressions enough to
> form a regex capable of doing this. Oddly enough, I also found the PHP
> documentation on Perl Regular Expressions to be very good, which should also
> help understand them.
>
> With spaces as your delimiters, it's as simple as "([^\s]+)(\s.*)?". You'll
> want to "trim" the second variable since it will have a leading space on it.
> Oh, and that's a Perl regex (use of \s to denote spaces).
>
> Eli.
>
>


Thanks - I have what I need for that step in the process.

parse_uri:
   warn set acl_c_parse_lookup = ${sg{$acl_c_parse_uri}{\N .*\s\N}{}}
       set acl_c_parse_lookup = ${sg{$acl_c_parse_lookup}{ }{}}
        set acl_c_parse_uri = ${sg{$acl_c_parse_uri}{\N^.*?\s\N}{}}
        acl = uribl_lookup
#    logwrite = PARSE1 - [$acl_c_parse_lookup]
   warn !condition = ${if eq{$acl_c_parse_uri}{}}
        acl = parse_uri
   accept