PDA

View Full Version : PyQt - QRegExp help



kks69
14th June 2013, 12:43
Hi there,

Very new to PyQt (and python) programming and trying to get an app going for my workplace. I keep trying to develop functionality that I don't yet have the skill/understanding to achieve yet. My program at the moment, is basically a notepad clone that will have some advanced features to common automate tasks for work built in. The gui has been constructed in QtDesigner if that means anything. Currently what I'd like to be able to do is parse what my user is entering into my QPlainTextEdit widget even while they are typing. It will need to constantly look for something in the format of A###### (alphabetic char followed by 6 numerals). Originally I was thinking of writing it so it will look up the current cursor position in the widget, then if the previous char was an alphabetic and the one before that a whitespace/none check if current char is numeral and so on so forth until it fits the format and has a whitespace typed at the end. But now that seems like a clumsy fix and I'm thinking there has to be a better way, will QRegExp help me out here? If so help please :).

amleto
14th June 2013, 20:27
yes, regex and qsyntaxhighlighter is probably a good place to start :)