replacing a part of a string using a regexp
Rajarshi Guha
rajarshi at presidency.com
Thu Jul 18 17:13:33 EDT 2002
More information about the Python-list mailing list
Thu Jul 18 17:13:33 EDT 2002
- Previous message (by thread): replacing a part of a string using a regexp
- Next message (by thread): Calling Fredrik Lundh, (dare i ask) Guido, all other Guru's, could this be a bug?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Thu, 18 Jul 2002 17:11:15 -0400, Fredrik Lundh wrote: > Rajarshi Guha wrote: > >> a line contains: >> >> <a href="www.myurl.com"> >> >> And I want to replace the url and make the line: >> >> <a href="http://myserver.com/prog.py?www.myurl.com"> >> >> Using re.sub I can substitute the whole string bewteen quotes, but the >> substituion needs to use the string that is *found* in the quotes. >> >> How can I access the matched portion in a re.sub() expression? > > (if you don't read the documentation, how come you always find the right > module/function to use? ;-) I did read the docs, but its been a hectic day and my brain seems to have slowed down :(
- Previous message (by thread): replacing a part of a string using a regexp
- Next message (by thread): Calling Fredrik Lundh, (dare i ask) Guido, all other Guru's, could this be a bug?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list