Try the following:
^(?:Yes|No)$
In VBScript, something like this:
Dim myRegExp, FoundMatch Set myRegExp = New RegExp myRegExp.Pattern = "^(?:Yes|No)$" FoundMatch = myRegExp.Test(SubjectString)
What was the problem?
You had an alternation with three options:
^Yes matches Yes at the beginning of the line, but also matches Yes in Yes, man...^No matches No at the beginning of the line, but also matches No in No way!^$ matches an empty string
source share