Re: [Tutor] List of regular expressions

2005-06-22 Thread Danny Yoo
On Wed, 22 Jun 2005, Shidan wrote: > Hi I have a list of regular expression patterns like such: > > thelist = ['^594694.*','^689.*','^241.*', >'^241(0[3-9]|1[0145]|2[0-9]|3[0-9]|41|5[1-37]|6[138]|75|8[014579]).*'] > > > Now I want to iterate thru each of these like: > > for pattern in thelis

Re: [Tutor] List of regular expressions

2005-06-22 Thread Alan G
> for pattern in thelist: >regex=re.compile(pattern) >if regex.match('24110'): >the_pattern = pattern >. >. >sys.exit(0) > > but in this case it will pick thelist[2] and not the list[3] as I wanted to, > how can I have it pick the pattern that describes it be

Re: [Tutor] List of regular expressions

2005-06-22 Thread Ewald Ertl
Hi Shidan! on Wed, 22 Jun 2005 00:28:44 -0400 Shidan <[EMAIL PROTECTED]> wrote : - Shidan > Hi I have a list of regular expression patterns like such: Shidan > Shidan > thelist = ['^594694.*','^689.*','

[Tutor] List of regular expressions

2005-06-21 Thread Shidan
Hi I have a list of regular expression patterns like such: thelist = ['^594694.*','^689.*','^241.*','^241(0[3-9]|1[0145]|2[0-9]|3[0-9]|41|5[1-37]|6[138]|75|8[014579]).*'] Now I want to iterate thru each of these like: for pattern in thelist: regex=re.compile(pattern) if regex.match('24