Validate

Phone, plate, and email-like checks.

Validation is fullmatch on the whole string. Print True/False for each example.

Goal

Check Kenya-style mobiles, a simple plate, and an email-like token.

import re
pat = re.compile(r"^07\d{8}$")
for phone in ("0712345678", "0712-345-678", "254712345678"):
    print(phone, bool(pat.match(phone)))
import re
pat = re.compile(r"^K[A-Z]{2} \d{3}[A-Z]$")
print(bool(pat.fullmatch("KCA 123A")))
print(bool(pat.fullmatch("kca 123a")))
import re
pat = re.compile(r"^[\w.]+@[\w.]+$")
print(bool(pat.fullmatch("kiosk.nairobi@example.com")))
print(bool(pat.fullmatch("not an email")))
import re
print(bool(re.fullmatch(r"\d{4}-\d{2}-\d{2}", "2026-01-12")))
print(bool(re.fullmatch(r"\d{4}-\d{2}-\d{2}", "12/01/2026")))