Nick
Nick

Reputation: 7525

How to limit users from entering english characters in a textbox

Do I need to use regex to ensure that the user has typed in English? All characters are valid except non English characters.

How do I validate this textbox?

Upvotes: 1

Views: 1603

Answers (3)

lmsasu
lmsasu

Reputation: 7583

You might use the FilteredTextBox form ASP.NET AJAX.

Upvotes: 0

IrishChieftain
IrishChieftain

Reputation: 15262

This has nothing to do with regular expressions and the link referred to by gurukulki does not answer the question either. To change language, you need to implement localization in your website:

http://www.west-wind.com/presentations/wwdbResourceProvider/introtolocalization.aspxlink text

http://www.codeproject.com/KB/aspnet/localizationByVivekTakur.aspx

Upvotes: 0

Kibbee
Kibbee

Reputation: 66162

A regex would work quite well for this. Something like

^[a-zA-Z0-9 ?!.,;:$]*$

would be a good starting point. It would allow all alphabetical and numerical characters, as well as some common punctuation. You would need to change it depending on what your definition of English characters is.

See the regex docs here for more information.

Upvotes: 6

Related Questions