alphabetic

Returns a regular expression for validating email addresses that only accepts lowercase letters, corresponding to the following pattern: ^[a-z]+@[a-z]+\.[a-z]+$.


Pattern symbols

Here's the explanation associated to each symbol used in this pattern:

  • ^ Beginning. Matches the beginning of the string, or the beginning of a line if the multiline flag (m) is enabled.

  • [] Character set. Match any character in the set.

  • a-z Range. Matches a character in the range "a" to "z" (char code 97 to 122). Case-sensitive.

  • + Quantifier. Match 1 or more of the preceding token.

  • @ Character. Match a "@" character (char code 64).

  • \. Escaped character. Matches a "." character (char code 46).

  • $ End. Matches the end of the string, or the end of a line if the multiline flag (m) is enabled.


Calling from Kotlin

Here's an example of calling this function from Kotlin code:

val regex: EmailAddressRegex = EmailAddressRegex.alphabetic()
val expected = """^[a-z]+@[a-z]+\.[a-z]+$"""
assertEquals(expected, "$regex")

Calling from Java

Here's an example of calling this function from Java code:

final EmailAddressRegex regex = EmailAddressRegex.alphabetic();
final String pattern = regex.toString();
final String expected = "^[a-z]+@[a-z]+\\.[a-z]+$";
Assertions.assertEquals(expected, pattern);