Here is the code for my regular expression on my aspx.cs page. The issue I am having is that when I use the same regular expression, ^\p{L}$, in the regular expression validatdor on my aspx page, it doesn't work. Is there something different between regular expression validators and a regular expression pattern int the code behind?
public static bool IsNameValid(string name)
{
string regExPattern = @"(^[\p{L}]$)";
if ((!System.Text.RegularExpressions.Regex.IsMatch(name, regExPattern)) || name.Length > 50)
return false;
else
return true;
}
I Put te same regex "(^[\p{L}]$)" in a RegularExpressionValidator and i think it works for me. Remember that que RegularExpressionValidator in html generate a javascript validator, maybe you have some error in the JS? Try to see in firebug (or other debugger) if are any error in javascript console.
PS: Sorry for my bad english.
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.