toString
Returns the string representation of this regular expression.
Calling from Kotlin
Here's an example of calling this function from Kotlin code:
val regex: EmailAddressRegex = EmailAddressRegex.default()
val result = "$regex" // or regex.toString()
assertEquals(expected = """^\S+@\S+\.\S+$""", result)Content copied to clipboard
Calling from Java
Here's an example of calling this function from Java code:
final String pattern = EmailAddressRegex.defaultPattern()
.toString();
final String expected = "^\\S+@\\S+\\.\\S+$";
Assertions.assertEquals(expected, pattern);Content copied to clipboard