Regex to match only two specific words, e.g. Yes or No -
my attempt is:
^yes|^no|^$ but when use this, words other "yes" , "no" matched
how fix it?
i've been testing regex using this online regex tester.
try this:
^(?:yes|no)$ in vbscript, this:
dim myregexp, foundmatch set myregexp = new regexp myregexp.pattern = "^(?:yes|no)$" foundmatch = myregexp.test(subjectstring) what problem?
you had alternation 3 options:
^yesmatchesyes@ beginning of string, matchyesinyes, man...^nomatchesno@ beginning of string, matchnoinno way!^$matches empty string
Comments
Post a Comment