PHPRegexpreg_match

Perform a regular expression match.

Syntax

preg_match(string $pattern, string $subject, array &$matches = null): int|false

Example

Enter values below to update the example in real time.

email
if
preg_match
echo
$email = "user@example.com";
if (preg_match('/^[a-z0-9.]+@[a-z0-9.]+.[a-z]{2,}$/', $email)) {
    echo "유효한 이메일";
}