Qt-interest Archive, April 2007
QRegExp: problem with kleene star respectively '*'
Message 1 in thread
Hello,
i recently encountered problems with QRegExp.
I generated the following regular expression to test, if a QChar is a
digit, whitespace, minus, opening bracket, closing bracket or a comma:
QRegExp valid("[\\d\\s-\\(\\),]");
then i did a
bool result = valid.exactMatch("*");
result is true.
Has anyone an idea why the given regular expression fits also the '*' ?
Did not find a suitable bug report, so possibly this is my mistake.
Thanks in advance.
seb
--
[ signature omitted ]
Message 2 in thread
Sebastian Breuers [mailto:sebbreuers@xxxxxx]
> I generated the following regular expression to test, if a QChar is a
> digit, whitespace, minus, opening bracket, closing bracket or a comma:
>
> QRegExp valid("[\\d\\s-\\(\\),]");
>
> then i did a
>
> bool result = valid.exactMatch("*");
>
> result is true.
[...-...] has a special meaning (defining a range).
Maybe that's your problem. If it is, try to move the dash
close to the [ or the ].
Andre'
--
[ signature omitted ]
Message 3 in thread
Thanks,
that was the problem.
seb
that was the problem
Am Apr 3, 2007 um 1:26 PM schrieb André Pönitz:
> Sebastian Breuers [mailto:sebbreuers@xxxxxx]
>> I generated the following regular expression to test, if a QChar is a
>> digit, whitespace, minus, opening bracket, closing bracket or a
>> comma:
>>
>> QRegExp valid("[\\d\\s-\\(\\),]");
>>
>> then i did a
>>
>> bool result = valid.exactMatch("*");
>>
>> result is true.
>
>
> [...-...] has a special meaning (defining a range).
> Maybe that's your problem. If it is, try to move the dash
> close to the [ or the ].
>
> Andre'
>
> --
> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx
> with "unsubscribe" in the subject or the body.
> List archive and information: http://lists.trolltech.com/qt-interest/
--
[ signature omitted ]