Re: [exim] Regex Parsing help

Pàgina inicial
Delete this message
Reply to this message
Autor: Eli Sand
Data:  
A: exim-users
Assumpte: Re: [exim] Regex Parsing help
> 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.