RegexReplace

Replaces a string that matches a regular expression pattern with a specified replacement string

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

Syntax:

SELECT SQLHTTP.net.RegexReplace ( @Text, @RegexPattern, @Replacement )

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. 

@Replacement nvarchar(4000) A replacement string for each RegexPattern occurrence found.

Return Type:

nvarchar(MAX)

Sample Usage:

Strip non-AlphaNumeric characters from a string

See Also: