How do I match this with re

Terry Reedy tjreedy at udel.edu
Thu Sep 4 12:57:44 EDT 2003


"Sunit Joshi" <sjoshi at ingr.com> wrote in message
news:8f8ffe67.0309040835.368f9565 at posting.google.com...
> Hello All
> I have a problem here where I need to find the drive letters in a
text
> file and replace them with another letter. Now the lines can be as
> long as this
>
> 6 'C:\pds\bddin64\report\mto\' 'SJOSHI'
> 'D:\pds\bddin64\report\format\' 'SJOSHI'
>
> with multiple entries for path; i.e. there may be 2, as above or 1
or
> more then 2. If I use the expression .*'([A-Z]:).*?', it only
matches
> the 2nd D: How do I get all the path groups ..??

Use file.readline() or .readlines() and then process one line at a
time.

Terry






More information about the Python-list mailing list