Regex
Available since: v3.0.0
A regex can be created by casting from a string.
The following examples all return true.
<regex> "a|b" = "a";
<regex> "col(o|ou)r" = "colour";
<regex> "((?i)col(o|ou)r|couleur)" = "COULEUR";
While regex was added as a standalone type in version 2.3.0, regex matching has always been available via the string::matches() function.
string::matches("a", "a|b");
string::matches("colour", "col(o|ou)r");
string::matches("COULEUR", "((?i)col(o|ou)r|couleur)");