OK. Any suggestion about backward capturing using QRegExp? In my example I want get "_1234_" from position 5.
OK. Any suggestion about backward capturing using QRegExp? In my example I want get "_1234_" from position 5.
What exactly do you want to capture?
Exactly explain what you are try to do (not how you are trying to achieve that).
I have gut feeling that you just need something like that (especially that your regular excretion is just a wild card):
Qt Code:
To copy to clipboard, switch view to plain text mode
An example, a cursor in texteditor is inside the keyword:
Qt Code:
blablabla get-deffunct|ion-list blalblabla (| <- cursor)To copy to clipboard, switch view to plain text mode
and I want detect is the word correct (get-deffunction-list) or not, if it is correct I need capture it.
It was a good idea for use reg expression for capturing left part and if it was correct get right part of word.
Searching word boundary (space, tabs etc) not a good idea, becouse:
Qt Code:
bla blablabla>=get-deffunction-list!=blalblabla blaTo copy to clipboard, switch view to plain text mode
is correct to.
Last edited by Nebelig; 20th June 2011 at 14:25.
1. if you have editor then you should use QTextDocument::find-4
2. in regular expression there is assertion "\b" which means word boundary (you don't have to use space or other character to detect that), see QRegExp documentation.
example: QRegExp("\\b\\w+\\b");
3. check qt examples there is something similar to your problem.
MarekR22, thanks for the advice.
Bookmarks