Regular Expressions 101

Community Patterns

1

email-validation_email_dogrulama

Created·2024-09-09 23:42
Flavor·PCRE2 (PHP)
^ - This indicates the beginning of the expression. - This part specifies that the first character cannot be a digit, hyphen, or underscore. So the first character must be a letter, period, or other special character. [A-z0-9.-]+ - This part requires the username to contain at least one character, and that character can be a letter, digit, period, or hyphen. @ - This represents the "@" symbol in the email address. [A-z.-]+ - This section states that the domain part must contain at least one character, and that character can be a letter, period, or hyphen. . - This represents the period character used to separate the domain from the top-level domain. [A-z]+ - This part requires the top-level domain to contain at least one character, and that character can only be a letter. $ - This indicates the end of the expression. ^ - Bu, ifadenin başlangıcını belirtir. - Bu bölüm, ilk karakterin rakam, tire veya alt çizgi olmaması gerektiğini belirtir. Yani ilk karakter harf, nokta veya diğer özel karakterlerden biri olmalıdır. [A-z0-9.-]+ - Bu kısım, kullanıcı adının en az bir karakter içermesi ve harf, rakam, nokta veya tire karakterlerinden oluşması gerektiğini gösterir. @ - Bu, e-posta adresindeki "@" sembolünü temsil eder. [A-z.-]+ - Bu bölüm, etki alanı kısmının en az bir karakter içermesi ve harf, nokta veya tire karakterlerinden oluşması gerektiğini belirtir. . - Bu, etki alanı uzantısını ayırmak için nokta karakterini gösterir. [A-z]+ - Bu kısım, etki alanı uzantısının en az bir karakter içermesi ve yalnızca harflerden oluşması gerektiğini ifade eder. $ - Bu, ifadenin sonunu belirtir.
Submitted by Emre Yıldırım

Community Library Entry

1

Regular Expression
Created·2024-06-21 08:22
Flavor·PCRE2 (PHP)

/
^(?!.*@.*@)(?!.*\.\.)(^[a-zA-Z0-9._%+-]{1,64}@)([a-zA-Z0-9.-]+\.[a-zA-Z]{2,}(?:\.[a-zA-Z]{2,255})?)$
/
gm
Open regex in editor

Description

Email validation

Explanation

  1. ^(?!.@.@) Asserts that the string does not contain two consecutive “@” symbols.

  2. ** (?!.*..)**
    Ensures that there are no consecutive periods (“.”) in the string.

  3. ^[a-zA-Z0-9._%+-]{1,64}@ Matches an email address with a maximum length of 64 characters before the “@” symbol. It allows alphanumeric characters, dots, underscores, percent signs, plus signs, and hyphens.

  4. ([a-zA-Z0-9.-]+.[a-zA-Z]{2,}(?:.[a-zA-Z]{2,255})?)$
    Captures the domain part of the email address. It allows alphanumeric characters, dots, and hyphens.

  5. (?:.[a-zA-Z]{2,255})? This group allows for optional subdomains (e.g., “.foo.bar”).

Includes

  • valid local part
  • Hostpart
  • valid TLD
  • optional SLD
  • unique @
  • No double dots > ..

If you have any improvements or issues: Cxbersxnic - Github

Submitted by Cxbersxnic