string.includesRegex()

Test if a String contains a substring that matches a provided regular expression.

Signature

includesRegex(regex: String) => Boolean

Description

Tests if the calling String contains a substring that matches a provided regular expression.

Parameters

Parameter Type Required Description

regex

String

true

Regular expression used to match a substring in the calling String. Supports Java regex.

Return value

Type Description

Boolean

If true, the calling String contains a substring that matches the provided regular expression. Otherwise, false.

Examples

'foo'.includesRegex('[a-z]')
true
\