[email protected]
[Top] [All Lists]

Re: QRegExp minimal match

Subject: Re: QRegExp minimal match
From: Bernd Strohhaecker
Date: Tue, 20 Mar 2007 16:59:36 +0100
Hi Martin,

also thanks. But this was only an example, the real regexp was more complicated and I only wondered why my first approach didn't work.

Especially because it workes fine in Perl - and also vbscript.regexp ;-)

FWIW, to realize this with greedy quantifier and leave exactly two chars for the later subexpressions you could also use a negative lookahead:


cu, Bernd

Martin Gebert schrieb:
Bernd Strohhaecker schrieb:
with setMinimal(true) and the string "abc" I expected the QRegExp "^(.*)(.)?(.)?$" to set the submatches $1=a, $2=b and $3=c.

Jasmins competent and authorative answer aside ;-) you could try if "^(.)*(.)?(.)?$" or "^(.)?(.)?(.)?$" accomplishes what you need. But that's just a "if you don't know how it works, try to find out" approach...


To unsubscribe - send a mail to [email protected] with 
"unsubscribe" in the subject or the body.
List archive and information: http://lists.trolltech.com/qt-interest/

<Prev in Thread] Current Thread [Next in Thread>