以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  [求助]如何判断字符串不能含有指定的字符?  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=153812)

--  作者:pc005637
--  发布时间:2020/8/24 11:57:00
--  [求助]如何判断字符串不能含有指定的字符?
上传的excel表,报告医师列,要求不能含有数字,除“·”和“.”外,不允许出现其他特殊字符。

如果在代码中判断?

--  作者:有点蓝
--  发布时间:2020/8/24 12:12:00
--  
Dim pattern As String = "[^\\u4e00-\\u9fa5.·]"
Dim txt = "地方地.方#好123"
Dim r As New System.Text.RegularExpressions.Regex(pattern)
If r.IsMatch(txt) Then
    MSGBOX("包含数字或者特殊字符")
End If