-3

我必须使用 asp.net RegularexpressionValidator 来验证来自文本框的输入。我想拒绝以开头的字符串"My Links"或者"My Urls"我已经使用了这个

   ^(?!My Links|My Urls)$

但这拒绝了一切。我该怎么写这个?

4

1 回答 1

2

If your goal is to reject all strings that start with My Links or My Urls, then you can use lookaheads, but only if you remove the $ at the end, or only the empty string will match:

^(?!My Links|My Urls)

works as expected.

于 2013-05-24T09:11:27.363 回答