Re: a newbie regex question

2008-01-25 Thread Max Erickson
Dotan Cohen [EMAIL PROTECTED] wrote: Maybe you mean: for match in re.finditer(r'\([A-Z].+[a-z])\', contents): Note the last backslash was in the wrong place. The location of the backslash in the orignal reply is correct, it is there to escape the closing paren, which is a special character:

Re: a newbie regex question

2008-01-25 Thread Dotan Cohen
On 24/01/2008, Jonathan Gardner [EMAIL PROTECTED] wrote: On Jan 24, 12:14 pm, Shoryuken [EMAIL PROTECTED] wrote: Given a regular expression pattern, for example, \([A-Z].+[a-z]\), print out all strings that match the pattern in a file Anyone tell me a way to do it? I know it's easy, but

a newbie regex question

2008-01-24 Thread Shoryuken
Given a regular expression pattern, for example, \([A-Z].+[a-z]\), print out all strings that match the pattern in a file Anyone tell me a way to do it? I know it's easy, but i'm completely new to python thanks alot -- http://mail.python.org/mailman/listinfo/python-list

Re: a newbie regex question

2008-01-24 Thread Jonathan Gardner
On Jan 24, 12:14 pm, Shoryuken [EMAIL PROTECTED] wrote: Given a regular expression pattern, for example, \([A-Z].+[a-z]\), print out all strings that match the pattern in a file Anyone tell me a way to do it? I know it's easy, but i'm completely new to python thanks alot You may want to

newbie regex

2005-10-17 Thread csselo
Hi I want to filter some strings,but i don t know how to use compile method. first character must be [a-zA-z] group and others can only be digits or letters. like a24354trt,Tsd1234 -- http://mail.python.org/mailman/listinfo/python-list

Re: newbie regex

2005-10-17 Thread Leif K-Brooks
[EMAIL PROTECTED] wrote: I want to filter some strings,but i don t know how to use compile method. Why not? first character must be [a-zA-z] group and others can only be digits or letters. if re.search('^[a-zA-Z][a-zA-Z0-9]*$', foo): print Valid string. else: print Invalid string.

Re: newbie regex

2005-10-17 Thread Leif K-Brooks
Leif K-Brooks wrote: [EMAIL PROTECTED] wrote: I want to filter some strings,but i don t know how to use compile method. Why not? Sorry: I misread that as not _wanting_ to use the compile method. -- http://mail.python.org/mailman/listinfo/python-list