[SOLVED] QRegExp doesn't match strings
-
wrote on 28 Jun 2013, 19:07 last edited by
Hello:
I want a regular expression able to catch strings that start with a pair of repeated letters so I wrote the following:
@QRegExp beginWithPair("^(\w)\1+");@
As far as I know It should match this string:
bq. aaarfads
and It doesn't.
What am I doing wrong?
Thanks
-
Hi,
What output do you expect ? And what do you get ?
-
wrote on 28 Jun 2013, 20:32 last edited by
When I use
@QRegExp::exactMatch ( const QString & str ) const@
I always get false.
I tried here and It worked:
-
Have a look at the documentation of exactMatch. Your string doesn't match exactly your regexp. If it was "aa" it would.
You should rather use indexIn
-
wrote on 29 Jun 2013, 15:26 last edited by
You're right.
Thank you.
-
You're welcome !
Don't forget to update the thread's title by prepending solved so other forum users may know a solution has been found :)
3/6