import tkMessageBox
import SearchEngine
from SearchDialogBase import SearchDialogBase
+import sre_parse
def replace(text):
root = text._root()
# XXX This code depends on internals of the regular expression
# engine! There's no standard API to do a substitution when you
# have already found the match. One should be added.
- # The solution here is designed to be backwards compatible
- # with previous Python versions, e.g. 1.5.2.
- # XXX This dynamic test should be done only once.
- if getattr(re, "engine", "pre") == "pre":
- return re.pcre_expand(m, template)
- else: # sre
- # XXX This import should be avoidable...
- import sre_parse
- # XXX This parses the template over and over...
- ptemplate = sre_parse.parse_template(template, m.re)
- return sre_parse.expand_template(ptemplate, m)
+ # XXX This parses the template over and over...
+ ptemplate = sre_parse.parse_template(template, m.re)
+ return sre_parse.expand_template(ptemplate, m)
def show_hit(self, first, last):
text = self.text