Python Regular Expressions: re.sub(regex, replacement, subject)
- From: Vibha Tripathi <vibtrip@xxxxxxxxx>
- Date: Tue, 5 Jul 2005 09:17:51 -0700 (PDT)
Hi Folks,
I put a Regular Expression question on this list a
couple days ago. I would like to rephrase my question
as below:
In the Python re.sub(regex, replacement, subject)
method/function, I need the second argument
'replacement' to be another regular expression ( not a
string) . So when I find a 'certain kind of string' in
the subject, I can replace it with 'another kind of
string' ( not a predefined string ). Note that the
'replacement' may depend on what exact string is found
as a result of match with the first argument 'regex'.
Please let me know if the question is not clear.
Peace.
Vibha
=======
"Things are only impossible until they are not."
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
.
- Follow-Ups:
- Re: Python Regular Expressions: re.sub(regex, replacement, subject)
- From: George Sakkis
- Re: Python Regular Expressions: re.sub(regex, replacement, subject)
- From: Benjamin Niemann
- Re: Python Regular Expressions: re.sub(regex, replacement, subject)
- From: Steven Bethard
- Re: Python Regular Expressions: re.sub(regex, replacement, subject)
- Prev by Date: Re: what is __init__.py used for?
- Next by Date: Re: More On - deepcopy, Tkinter
- Previous by thread: Good starterbook for learning Python?
- Next by thread: Re: Python Regular Expressions: re.sub(regex, replacement, subject)
- Index(es):
Relevant Pages
|