Skip to content

danielgalizi/sql-server-regex

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SQL Server Regex

SQL Regex Logo

SQL-Server-Regex gives you the power to run regular expressions inside SQL Server queries. It works by using SQL CLR functions to call the C# System.Text.RegularExpressions library.

Examples

Match

The RegexMatch() scalar function lets you call a regular expression against a string, and returns the first result if there is a match.

Match SSMS example

Matches

The RegexMatches() table-valued function lets you call a regular expression against a string, and returns all matches.

Matches SSMS example

Group Match

The RegexGroupMatch() scalar function lets you call a regular expression with named groups against a string, and returns the group name you specify.

Group Match SSMS example

Replace

The RegexReplace() scalar function lets you call a regular expression to find-and-replace inside a string. You can also match parts of a string and re-arrange them using references.

Replace SSMS example

Split

The RegexSplit() table-valued function lets pass a regular expression against a string to split it into pieces, and returns the pieces.

Split SSMS example

Installation

You can install sql-server-regex on most versions of SQL Server. This works the same for virtual machines or cloud VMs.

You can also install sql-server-regex onto AWS RDS.

Testing

This work has been tested, both for functionality and performance.

Resources

About

Run regular expressions in SQL Server

Resources

License

Stars

0 stars

Watchers

1 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • C# 71.1%
  • PLSQL 15.0%
  • PLpgSQL 13.9%