Hi,
Do any one of you know the regular expression for user name that allows special characters(. and _) but not at the end of the string. For example, it should not allow the user to enter "john123." or "John_". But the otherwise is acceptable. For example, the user names "john.harlow" or "john_harlow".
Thanks
Shwetha
Loading
shwetha sonarPosted Nov 28, 2011, 7:46 AM
Thanks for the reply.
The suggested regular expression does not work. It still does not meet the requirements.
Shwetha
VulpesPosted Nov 20, 2011, 5:12 AM
You could therefore simplify the regular expression to:
string regexp = @".*[^_\.]$";
VulpesPosted Nov 19, 2011, 6:36 PM
shwetha sonarPosted Nov 19, 2011, 5:58 PM
Thanks for the reply.
But, the suggested expression does not meet the requirement. It is not allowing me to enter the special characters I want (ie . and _). Also, majorly it does not accept any string for the user name. For example: only aplhabets or aplhanumeric.
Regards
Shwetha
VulpesPosted Nov 19, 2011, 6:50 AM
string regexp = @"^(?=.*[^_\.\(\)]+$)[A-Za-z0-9_\.\(\)]+$";