我想确保使用自定义表达式验证器,我可以使用[^“'尝试不使用'或',但每当我放普通字母时它也不起作用。
答案 0 :(得分:0)
我会做一个正则表达式替换匹配['“]并将其替换为空(即”“”)。
在VB.NET中,代码如下:
dim strTest as string = "This "is" a test'"
dim regex as regex = new regex("[" & chr(34) & "']", regexoptions.ingorePatternWhitespace)
msgbox(regex.Replace(strTest, ""))
输出 这是一个测试 。