[Qt-interest] Regular Expression Validating Username in QT

Robert Voinea rvoinea at gmail.com
Tue Jan 12 13:49:18 CET 2010


On Tuesday 12 January 2010 14:39:24 Raja Rokkam wrote:
> ^[a-zA-Z0-9][\.a-zA-Z0-9 at _$-]+
> or
> ^[a-zA-Z0-9][\\.a-zA-Z0-9 at _$-]+

Add an "$" to the end of the regex.
eg: ^[a-zA-Z0-9][\\.a-zA-Z0-9 at _$-]+$
so it matches the whole string not just a substring that starts at the 
begining of the string.


> did not help as, it is still matching asdf.@* . I have tried escaping the
> dot in both the ways mentioned but to no avail.
> 
> On Tue, Jan 12, 2010 at 5:53 PM, Ivan Kharin <korsar.akvis at gmail.com> wrote:
> > > Raja.
> > > Hi All,
> > >           I am trying to write a regexp validating an username which
> >
> > contains  a-z 0-9 -.@$
> >
> > QRegExp usRx( "^[-_$@\.a-zA-Z0-9]+" );
> >
> >
> > --
> > Regards,
> > Ivan Kharin
> >
> > _______________________________________________
> > Qt-interest mailing list
> > Qt-interest at trolltech.com
> > http://lists.trolltech.com/mailman/listinfo/qt-interest
> 

-- 
Robert Voinea
IT Specialist
+4 0740 467 262

Don't take life too seriously. You'll never get out of it alive.
(Elbert Hubbard)



More information about the Qt-interest-old mailing list