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:
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
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
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
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
[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.
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