Hello, I have a string, and I use a regular expression to search a match in it. When I find one, I would like to break down the string, using the matched part of it, to be able to perform some formatting and to later build a brand new string with the separate parts.
The regular expression part works ok, but my problem is to extract the matched pattern from the string. I'm not sure how to do that... sString = 'mt_03_04_04_anim' # Create regular expression object oRe = re.compile( "\d\d_\d\d\_\d\d" ) # Break-up path aString = sString.split( os.sep ) # Iterate individual components for i in range( 0, len( aString ) ): sSubString = aString[i] # Search with shot number of 2 digits oMatch = oRe.search( sSubString ) if oMatch != None: # Replace last sequence of two digits by 3 digits!! Any suggestion would be welcomed. Thanks! Bernard _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor