[Qt-interest] Problem with qregexpr
matteo
matteo.ceruti at task84.it
Tue Oct 6 08:48:55 CEST 2009
If I use QRegExp::exactMatch() with the pattern ("--\\s*STRING"), it
matchs with "--DUMMY" and not only with "--STRING". I need that it
matchs only with "--STRING" or "-- STRING" with many space from --
and STRING.
Regards
Teo
Alexandre Beraud wrote:
> Hi,
>
> If you use QRegExp::exactMatch(), then you don't need ^ and $ around
> your text since they mark the beginning and the end of the string. Also,
> \b has no size _but_ it does represent something: the boundary between a
> word character (\w) and a non-word character (\W). - is not a word
> character, thus \b-- won't match unless you have something like: A--STRING
>
> Regards,
>
> Alex
>
>
> matteo a écrit :
>
>> Hi,
>> I have the string
>>
>> --STRING
>>
>> If I try to match whith QRegExp("--\\s*STRING") it runs, but if I try
>> with QRegExp("\\b(--\\s*STRING)\\b") it doesn't match.
>>
>> Where is my mistake?
>>
>> Thanks
>> Teo
>> _______________________________________________
>> Qt-interest mailing list
>> Qt-interest at trolltech.com
>> http://lists.trolltech.com/mailman/listinfo/qt-interest
>>
>>
>>
>
>
>
More information about the Qt-interest-old
mailing list