[Qt-interest] QRegExp match end of a string

Louis Hoefler louis.hoefler at gmx.de
Wed Feb 2 22:30:42 CET 2011


Indeed, I missunderstood the documentation.
I thought $ matches \r or \n automatically.
This regexp works without errors:
QRegExp("sometext[\\r\\n]+$")

Thank you, Louis

Am 02.02.2011 21:11, schrieb slayer81 at gmx.de:
> Am 02.02.2011 21:01:19, schrieb Louis Hoefler<louis.hoefler at gmx.de>:
>
>> I modified the regexp to
>>
>> QRegExp("sometext.*$")
>>
>> and now it does work.
> Is there possibly a line break in your string after "sometext"?
>
>> Greetings Louis
>>
>> Am 02.02.2011 20:44, schrieb Louis Hoefler:
>>> Hello everyone,
>>> I try to match string who end with "sometext".
>>>
>>> I use this QRegExp("sometext$") to do so.
>>> Now, I call qstring.contains(regexp)
>>> to see weather the regexp matched.
>>>
>>> Howevery, lines who end with "sometext" return
>>> no match, but I do not really understand why.
>>>
>>> Using this regexp to test for strings who only
>>> contain spaces, tabs or nothing works
>>> QRegExp("^[\\s\\t]*$")
>>>
>>> Greetings, Louis
>>> _______________________________________________
>>> Qt-interest mailing list
>>> Qt-interest at qt.nokia.com
>>> http://lists.qt.nokia.com/mailman/listinfo/qt-interest
>>>
>> _______________________________________________
>> Qt-interest mailing list
>> Qt-interest at qt.nokia.com
>> http://lists.qt.nokia.com/mailman/listinfo/qt-interest
>>
>
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at qt.nokia.com
> http://lists.qt.nokia.com/mailman/listinfo/qt-interest
>



More information about the Qt-interest-old mailing list