of

@ExperimentalSince(version = KotoolsTypesVersion.V5_1_0)
infix fun of(pattern: String): EmailAddressRegex?

Returns a regular expression for validating email addresses with the specified pattern, or returns null if the pattern doesn't match the default one.


Calling from Kotlin

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

assertNotNull(EmailAddressRegex of """^[a-z]+@[a-z]+\.[a-z]+$""")

Calling from Java

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

final String pattern = "^[a-z]+@[a-z]+\\.[a-z]+$";
final EmailAddressRegex result = EmailAddressRegex.of(pattern);
Assertions.assertNotNull(result);