By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,851 Members | 1,131 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,851 IT Pros & Developers. It's quick & easy.

How to get input as comma and alphabet alone??

P: 14
Hi,

Im using C# ASP.Net here in the textbox i need to get the input as like follows

,any alphabet or any alphabet,any alphabet for example ,C or C,E like this i want to get the input.The textbox should get only one comma and it should not get any other special characters.it can be either by server side code or by the java script code..How should i do this any assistance plz..



rgrds



Kanna..
May 8 '07 #1
Share this Question
Share on Google+
1 Reply


acoder
Expert Mod 15k+
P: 16,027
You'll want to use a regular expression for this.

Read about regular expressions here.

However, your validation should be on both the client side and the server side (in case javascript is disabled).

Does your string have to be case-sensitive, i.e. does it matter if the letter is lower-case?

A possible regular expression:
/^([A-Z])?,[A-Z]$/
May 8 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.