Matches "truthy" or "falsy" text values 1/0, y/n, yes/no, t/f, true/false or on/off.
Text | Result |
---|---|
0
| match |
1
| match |
n
| match |
y
| match |
no
| match |
yes
| match |
f
| match |
t
| match |
false
| match |
true
| match |
off
| match |
on
| match |
maybe | no match |
1
2
You can test whether the value was truthy or falsy based on the match groups like this (PHP):
preg_match('/.../', 'true', $matches);
$value = (bool)$matches[1];