[Qt-interest] Regular Expression Validating Username in QT

Josiah Bryan jbryan at productiveconcepts.com
Tue Jan 12 13:24:09 CET 2010


Raja Rokkam wrote:
> Hi All,
>
>           I am trying to write a regexp validating an username which 
> contains  a-z 0-9 -.@$
>
>
> The regexp I have now is: QRegExp usRx( 
> "^[a-zA-Z0-9][.]*[a-zA-Z0-9 at _$-]+" ); which matches everything. If I 
> removed the "[.]*" it  jus checks for characters I need excluding the 
> dot.
> I am able to create regular expression for all the set except for dot 
> . Whenever I try keeping the "dot" it starts taking in any character. 
> Is there a special way in QT to do this ?
>
Have you tried escaping the dot? e.g: \\.

-josiah




More information about the Qt-interest-old mailing list