RegexSplit

Splits a string into one or more substrings (Regex Version)

  • Free Function
  • SQL Server Compatibility: 2008, 2012, 2014, 2016, 2017

Syntax:

SELECT SQLHTTP.net.RegexSplit ( @Text, @RegexPattern, @Index )

Arguments:

Name Type Description
@Text nvarchar(MAX)

String expression containing substrings and delimiters. 

@RegexPattern nvarchar(4000) String expression containing a regex expression. See Regular Expression Language – Quick Reference for more information. Even though this parameter is required, a NULL value indicates that no regex expression is to be used.
@Index bigint Integer value specifying the location of a substring

Return Type:

nvarchar(MAX)

Sample Usage:

Split by whitespace sequences of any size:
Split by alphabetic strings to extract numeric values:

See Also: