Reputation: 2453
I have my variable $_GET['artist']
and I'd like to check :
one
letter, and this letter is from a
to z
(case sensitive, so A
is not valid);all
or other
How can I check it with regex
and preg_match()
on PHP?
Upvotes: 1
Views: 1661
Reputation: 24244
if (preg_match('/^([a-z]|all|other)$/', $_GET['artist']) === 1) {
// True
}
Assuming all
and other
should also be case sensitive.
Upvotes: 6