Regex validation - boolean

1,154 views
Skip to first unread message

Houdini

unread,
Apr 10, 2006, 8:49:52 AM4/10/06
to Regex
Hello all,

I am not very proficient in regexes (yet) and would greatly appreciate,
if anyone could help me to do the following:
need to validate boolean data type, the expression should allow
following values:

"0","1","True","False","true","false".

Thank you very much. The True/False can be case insensitive so even
fAlse could be permited, if that eases the expression.

Houdini

Sergei Z

unread,
Apr 10, 2006, 10:18:06 AM4/10/06
to Regex

IF u have the input text '0', "1","True","False","true","false"
formatted as STRINGS, then u can use OR-logic to allow the 4 values
using Option IgnoreCase= TRUE (ON):

validation pattern would be

^(0|1|true|false)$

meaning that tested input (string) should containg only the OR-ed items
and nothing else

Reply all
Reply to author
Forward
0 new messages