[Interest] QRegExp exclamation marks

Sensei senseiwa at gmail.com
Tue May 28 08:24:32 CEST 2013


On 5/27/13 7:25 PM, Thiago Macieira wrote:
> On segunda-feira, 27 de maio de 2013 16.48.13, Sensei wrote:
>> QRegExp r("\\b(PROGRAM WARNING|!\\s)");
>>
>>
>> it matches just the second line, not the "! " patterns.
>
> \b is "word boundary". You need to have a \w (word) on one side and \W (non-
> word) on the other. Both the beginning of a line and the exclamation marks are
> non-words, so it will never match.


Thank you Thiago, now it makes sense. I've tried desperately to escape 
"!", but Bo's trick worked right away.

Cheers!




More information about the Interest mailing list