matches
Returns true if the specified text matches this regular expression, or returns false otherwise.
Calling from Kotlin
Here's an example of calling this function from Kotlin code:
val text = "[email protected]"
val regex: EmailAddressRegex = EmailAddressRegex.alphabetic()
assertTrue(regex matches text)Content copied to clipboard
Calling from Java
Here's an example of calling this function from Java code:
final String text = "[email protected]";
final EmailAddressRegex regex = EmailAddressRegex.alphabetic();
final boolean result = regex.matches(text);
final String message = String.format(
"'%s' matches the following regular expression: '%s'.",
text,
regex
);
Assertions.assertTrue(result, message);Content copied to clipboard