regular expression

Batara Kesuma bkesuma at REMOVECAPITALS.yahoo.com
Sat May 18 13:34:16 EDT 2002


Hi,

I tried to look at the docs, but couldn't get it.

How can I compile the regex rule, and match a list? I want to print out
only list that contains 6 digits in it.

--- start ---

import re
list = ['123456', '234567', '123', 'abc', '1234567']

for x in list:
  rule = re.compile(\d{6,6})  // here I don't know...
  if rule.match(x):
    print x

--- end ---

Please help, and thank you very much...






More information about the Python-list mailing list