I have a string variable in C# and I want to check this string contains letters or not.
I used following regular expression for evaluate this condition, but I returned false in the if
statement I used.
I dont know why?
My C# Code:
string cellValue ="Row Merging Done here";
if (Regex.IsMatch(cellValue, @"^[a-zA-Z]+$"))
{
messageBox.show("Message found");
}
How to evalute this regular expression?
您是否不需要识别空格: @"^[a-zA-Z ]+$"
Do you need to check whether the string contains at least one word? If so, you don't need symbols for beginning and end:
if (Regex.IsMatch(cellValue, @"[a-zA-Z]+"))
您可以使用: RegExr评估您的表情
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.