[PyQt] combining python regex with QPlainTextEdit?

David Cortesi davecortesi at gmail.com
Thu Jul 28 03:41:42 BST 2011


This is a high-level design question. I'm looking at writing a PyQt-based
replacement for an old app written in Perl/TCL. It is basically a
specialized text editor and QPlainTextEdit would be a nifty basis with one
exception: regex find/replace.

The old app fully exposed Perl regex syntax in its Find/Replace dialog, and
the small user community is used to complex regex-based global changes. So a
new app needs to offer regex function at least as good as Perl's. This does
not describe QRegExp. But the regex module from pypi is as good as Perl,
esp. for UTF-8 files which these are.

The question is: in general terms how feasible would it be to provide
Python-regex based Find/Replace when the document is held in and mostly
edited through a QPlainTextEdit? Is it practical to work back and forth
between the world of QTextCursors and the world of Python u"string" values?
In high level terms, how would one implement a regex Find, followed by a
Replace-and-Find-Next?

Thanks for any insights,
Dave Cortesi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20110727/5aac0261/attachment.html>


More information about the PyQt mailing list