mdq.RegexMatches (Transact-SQL)

Searches an input string for all occurrences of a regular expression and returns all the successful matches. This function uses the regular expression functionality of the Matches method in the Microsoft .NET Framework. mdq.RegexMatches is in the mdq schema and is available only in the Master Data Services database.

Topic link iconTransact-SQL Syntax Conventions

Syntax

mdq.RegexMatches (input,pattern,mask)

Arguments

  • input
    Is the input string for which to find matches. input is nvarchar(4000) with no default.

  • pattern
    Is the regular expression pattern to use for matching. pattern is nvarchar(4000) with no default.

  • mask
    Is the RegexOptions mask that specifies the behavior of the regular expression. For more information, see mdq.RegexMask (Transact-SQL).

Table Returned

Column name

Column type

Description

Sequence

int

Is the sequence of the tokens in the result stream.

Token

nvarchar(4000)

Is the token that matched the specified pattern.

Permissions

Requires membership in the public role.

Examples

The following example checks whether the input string matches the specified regular expression pattern.

USE MDM_Sample;
GO

SELECT * FROM mdq.RegexMatches(N'1 is one, 2 is two', N'\d+', 0);

See Also

Reference

Master Data Services Functions (Transact-SQL)

Concepts

Master Data Services

Other Resources

System.Text.RegularExpressions Namespace