How this regex match example works
preg_match() returns 1 when the pattern matches and stores captured groups in $matches. Patterns are written in single quotes so that \. and \$ reach the regex engine unchanged. For real email validation, filter_var($email, FILTER_VALIDATE_EMAIL) is more reliable than a hand-written pattern.