[Tutor] advise on using re
Kent Johnson
kent37 at tds.net
Sun Feb 15 15:27:31 CET 2009
On Sun, Feb 15, 2009 at 5:53 AM, Norman Khine <norman at khine.net> wrote:
>>>> MXlocate = re.compile('^.*preference = (\d*).*exchanger = (.*)$',
> On the shell, the command
>
> $ nslookup -querytype=MX abakuc.com
> Server: 193.252.19.3
> Address: 193.252.19.3#53
>
> Non-authoritative answer:
> abakuc.com mail exchanger = 30 ASPMX3.GOOGLEMAIL.com.
> abakuc.com mail exchanger = 30 ASPMX4.GOOGLEMAIL.com.
> abakuc.com mail exchanger = 30 ASPMX5.GOOGLEMAIL.com.
> abakuc.com mail exchanger = 60 mail.abakuc.com.
> abakuc.com mail exchanger = 10 ASPMX.L.GOOGLE.com.
> abakuc.com mail exchanger = 20 ALT1.ASPMX.L.GOOGLE.com.
> abakuc.com mail exchanger = 20 ALT2.ASPMX.L.GOOGLE.com.
> abakuc.com mail exchanger = 30 ASPMX2.GOOGLEMAIL.com.
>
>
> I would like to extract the MX servers in to a list.
None of your output lines contain the text 'preference = ' so your re
does not match any of them. A standalone re tester can help with
figuring out re's, for example Tools/scripts/redemo.py which comes
with Python.
Kent
More information about the Tutor
mailing list