[Tutor] Help With Regular expression? - Partial solution

Karthikesh Raju karthik at james.hut.fi
Fri Sep 3 09:42:06 CEST 2004


Hi All,

i found a partial solution somthing like

p = re.compile('\( [0-9]+  [0-9]+ \)')

this will match (5 6), or any tuple with 2 indices, i want to put an
optional part something like

('\( [0-9]+ ([0-9]?+) \)')
so that i can match any thing of the form
( 5 ) ( 5 6 ) (5 6 7) and so on ..

How should one craft it ..

warm regards

karthik
-----------------------------------------------------------------------
Karthikesh Raju,		    email: karthik at james.hut.fi
                                           karthikesh.raju at gmail.com
Researcher,			    http://www.cis.hut.fi/karthik
Helsinki University of Technology,  Tel: +358-9-451 5389
Laboratory of Comp. & Info. Sc.,    Fax: +358-9-451 3277
Department of Computer Sc.,
P.O Box 5400, FIN 02015 HUT,
Espoo, FINLAND
-----------------------------------------------------------------------


More information about the Tutor mailing list