View Single Post
Old Apr 22nd, 2005, 1:50 PM   #3
mpn
Newbie
 
Join Date: Apr 2005
Posts: 2
Rep Power: 0 mpn is on a distinguished road
I only know how to match with that regular expression. How do I extract the three variables using it?

I'm actually using Python+scanf, but I posted here because I thought you all would be the best with regexp. Reasonable assumption? So here's where/how it's failing in Python:

>>> scanf.sscanf('(02:24:26) username: message', '(%s) %s: %s')
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "scanf.py", line 341, in sscanf
return bscanf(CharacterBufferFromIterable(inputString), formatString)
File "scanf.py", line 362, in bscanf
return parser(buffer)
File "scanf.py", line 523, in __call__
raise IncompleteCaptureError, (e, tuple(results))
scanf.IncompleteCaptureError: (<scanf.FormatError instance at 0x403f54ac>, ('02:
24:26)',))
mpn is offline   Reply With Quote