TextBox如何使用正则表达式

[复制链接]
查看11 | 回复5 | 2009-6-12 23:19:37 | 显示全部楼层 |阅读模式
话不多说直接上码public string getData(string data)
{
bool bl = System.Text.RegularExpressions.Regex.IsMatch(data, @"\d{3}-\d{8}|\d{4}-\d{7}");
string str;
if (bl)
{
return str = "
正确
";
}
else
{
return str = "...
回复

使用道具 举报

千问 | 2009-6-12 23:19:37 | 显示全部楼层
RegularExpressionValidator1.ControlToValidate = txtTele属性窗口设置...
回复

使用道具 举报

千问 | 2009-6-12 23:19:37 | 显示全部楼层
用验证控件里的正则表达式控件...
回复

使用道具 举报

千问 | 2009-6-12 23:19:37 | 显示全部楼层
ValidateExpression属性就行...
回复

使用道具 举报

千问 | 2009-6-12 23:19:37 | 显示全部楼层
=48)&&(event.keyCode <=57))||(event.keyCode==45)) {event.returnValue=true;} else{event.returnValue=false;}" ...
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行