比如:匹配4位数字或者6位数字
^\d{6}$和^\d{4}$
怎么连接到一起 用或 我试了|和|| 不好用啊 我语言是c#
求正确格式
正则表达式并且连接怎么做,谢谢
- 写回答
- 好问题 0 提建议
- 追加酬金
- 关注问题
- 邀请回答
-
2条回答 默认 最新
- Go 旅城通票 2017-01-07 05:26关注
System.Text.RegularExpressions.Regex r = new Regex(@"^(\d{4}|\d{6})$"); Response.Write(r.IsMatch("111") + "<BR>"); Response.Write(r.IsMatch("1111") + "<BR>"); Response.Write(r.IsMatch("11111") + "<BR>"); Response.Write(r.IsMatch("111111") + "<BR>"); Response.Write(r.IsMatch("1111a1") + "<BR>");
解决 无用评论 打赏 举报