The string on which you wish to apply the regex pattern. Can be a string or any valid expression that resolves to a string.
Optional
options?: RegexOptionsThe following
Note: You cannot specify options in both the regex and the options field.
Option Description
i
Case insensitivity to match both upper and lower cases. You can specify the option in the options field or as part of the regex field.
m
For patterns that include anchors (i.e. ^ for the start, $ for the end), match at the beginning or end of each line for strings with multiline values. Without this option, these anchors match at beginning or end of the string.
If the pattern contains no anchors or if the string value has no newline characters (e.g. \n), the m option has no effect.
x
"Extended" capability to ignore all white space characters in the pattern unless escaped or included in a character class.
Additionally, it ignores characters in-between and including an un-escaped hash/pound (#) character and the next new line, so that you may include comments in complicated patterns. This only applies to data characters; white space characters may never appear within special character sequences in a pattern.
The x option does not affect the handling of the VT character (i.e. code 11).
You can specify the option only in the options field.
s
Allows the dot character (i.e. .) to match all characters including newline characters.
You can specify the option only in the options field.
The regex pattern to apply. Can be any valid expression that resolves to either a string or regex pattern /
Alternatively, you can also specify the regex options with the options field. To specify the s or x options, you must use the options field.
You cannot specify options in both the regex and the options field.
Generated using TypeDoc
Applies a regular expression (regex) to a string and returns a boolean that indicates if a match is found or not.