Python idiom: Multiple search-and-replace
Darrell Gallion
dgallion1 at yahoo.com
Wed Apr 12 10:46:09 EDT 2000
Been there done that.
My solution is more work than Fredrik's, unless you
plan on making a lot of changes to the buffer.
Like many hundreds of patterns on a large buffer.
Keep a list of changes to be performed.
(start, seqNumber, text, end)
seqNumber stabilizes the sort of this list.
If the start==end then delete a section.
Sort the list and perform all operations at once.
This is like a transaction, which allows for some
other cool features. Such as detecting conflicting or
overlapping changes.
I have code if you want it.
=====
Darrell Gallion
__________________________________________________
Do You Yahoo!?
Send online invitations with Yahoo! Invites.
http://invites.yahoo.com
More information about the Python-list
mailing list