a re question

Rajarshi Guha rajarshi at presidency.com
Mon Sep 9 16:10:39 EDT 2002


Hi,
  I have a file with lines of the format:

001 Abc D Efg 123456789   7 100 09/05/2002 20:23:23
001 Xya FGh   143557789   7 100 09/05/2002 20:23:23

I am trying to extract the 9 digit field and the single digit field
immediatley after that.

When I use Visual Regexp to try out the regexp 

(\d{9,} {3,}\d)

it highlights the 2 fields exactly. 

But when I use the following Python code I get None:

>> s='001 Abc D Efg 123456789   7 100 09/05/2002 20:23:23'
>> p = re.compile(r'(\d{9,} {3,}\d)')
>> print p.match(s)
>> None

Could anybody point out where I'm going wrong?

Thanks,



More information about the Python-list mailing list