Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Regular expressions in asp.net c#

Tags:

c#

regex

asp.net

I have a simple query. I am new to regular expression validations in C#.

I want some expression which would allow only single alphabet that means a-z or A-Z. It should not allow whole word. Can anyone suggest me an expression?

like image 411
shruti Avatar asked Jan 27 '26 16:01

shruti


1 Answers

The following should work:

[a-zA-Z]+

This expression allows one or more characters in the specified range. And if you want only a single character:

[a-zA-Z]
like image 160
Darin Dimitrov Avatar answered Jan 30 '26 05:01

Darin Dimitrov



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!