Not available in Cloud edition.
Type: Scalar function

Returns whether a regular expression can find a match in a string.

Return value: bit

Returns NULL if @str is null, 1 if a match is found, 0 if no match is found.


@str mandatory nvarchar(max)
String to match against.
@pattern mandatory nvarchar(max)
Pattern to search for, for example '[a-z][a-z0-9]*'.

See the documentation for the System.Text.RegularExpressions.Regex class for syntax.
@options optional nvarchar(20)
A concatenaded string of characters setting the options of the regexp matching, for example 'imx'.

This parameter is case-sensitive.
If NULL then the option 'i' (case-insensitive) is used.

If you want a case-sensitive match without any other options then specify the empty string ('').
Possible value Description
i Case-insensitive match.
m Multiline mode. Changes the meaning of ^ and $ so they match at the beginning and end, respectively, of any line, and not just the beginning and end of the entire string.
s Single-line mode. Changes the meaning of the dot (.) so it matches every character (instead of every character except \n).
x Ignore whitespace and comments in the pattern.