Re: [exim] String expansion: reversing a domain name?

Página superior
Eliminar este mensaje
Responder a este mensaje
Autor: Jakob Hirsch
Fecha:  
A: 'Exim-users'
Asunto: Re: [exim] String expansion: reversing a domain name?
Marc Sherman wrote:

> Is it possible to reverse a domain name with Exim's string expansion
> operators?
>
> EG: given input "foo.bar.baz.com", output "com.baz.bar.foo".


If the number of components of the domain name is constant (e.g. always
4), you can do it with
${sg{some.sample.host.name}{\N([^.]+)\.([^.]+)\.([^.]+)\.([^.]+)\.?\N}{\$4.\$3.\$2.\$1}}.
At least I don't know how else one could do that with regex, but I'm no
expert for that.

If you want to do it for any domain name I think you have to run some
external script, like Tony already wrote.