Re: Help with Regex for domain names

2009-08-02 Thread Aahz
In article , MRAB wrote: >Nobody wrote: >> On Thu, 30 Jul 2009 10:29:09 -0700, rurpy wrote: >> regex = re.compile(r'[\w\-\.]+\.(?:us|au|de)') >>> You might also want to consider that some country >>> codes such as "co" for Columbia might match more than >>> you want, for example: >>> >>>

Re: Help with Regex for domain names

2009-07-30 Thread MRAB
Nobody wrote: On Thu, 30 Jul 2009 10:29:09 -0700, rurpy wrote: regex = re.compile(r'[\w\-\.]+\.(?:us|au|de)') You might also want to consider that some country codes such as "co" for Columbia might match more than you want, for example: re.match(r'[\w\-\.]+\.(?:us|au|de|co)', 'foo.boo.com')

Re: Help with Regex for domain names

2009-07-30 Thread Nobody
On Thu, 30 Jul 2009 10:29:09 -0700, rurpy wrote: >> regex = re.compile(r'[\w\-\.]+\.(?:us|au|de)') > > You might also want to consider that some country > codes such as "co" for Columbia might match more than > you want, for example: > > re.match(r'[\w\-\.]+\.(?:us|au|de|co)', 'foo.boo.com') >

Re: Help with Regex for domain names

2009-07-30 Thread rurpy
On Jul 30, 9:56 am, MRAB wrote: > Feyo wrote: > > I'm trying to figure out how to write efficiently write a regex for > > domain names with a particular top level domain. Let's say, I want to > > grab all domain names with country codes .us, .au, and .de. > > > I could create three different regex

Re: Help with Regex for domain names

2009-07-30 Thread Feyo
On Jul 30, 11:56 am, MRAB wrote: > Feyo wrote: > > I'm trying to figure out how to write efficiently write a regex for > > domain names with a particular top level domain. Let's say, I want to > > grab all domain names with country codes .us, .au, and .de. > > > I could create three different rege

Re: Help with Regex for domain names

2009-07-30 Thread MRAB
Feyo wrote: I'm trying to figure out how to write efficiently write a regex for domain names with a particular top level domain. Let's say, I want to grab all domain names with country codes .us, .au, and .de. I could create three different regexs that would work: regex = re.compile(r'[\w\-\.]+\

Re: Help with Regex for domain names

2009-07-30 Thread Tim Daneliuk
Feyo wrote: > I'm trying to figure out how to write efficiently write a regex for > domain names with a particular top level domain. Let's say, I want to > grab all domain names with country codes .us, .au, and .de. > > I could create three different regexs that would work: > regex = re.compile(r'

Help with Regex for domain names

2009-07-30 Thread Feyo
I'm trying to figure out how to write efficiently write a regex for domain names with a particular top level domain. Let's say, I want to grab all domain names with country codes .us, .au, and .de. I could create three different regexs that would work: regex = re.compile(r'[\w\-\.]+\.us) regex = r