toString

override fun toString(): String

Returns the string representation of this regular expression.


Calling from Kotlin

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

val pattern: String = EmailAddressRegex.default()
    .toString()
val expected = """^\S+@\S+\.\S+$"""
assertEquals(expected, pattern)

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);