Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
28 lines (15 sloc) 930 Bytes


SQL Regex Logo

RegexSplit() is a table-valued function that lets you split a string into pieces using a specified regular expression. RegexSplit() is a SQL CLR table-valued function that exposes the System.Text.RegularExpressions' Split() method.

Let's look at a few examples, inspired by another handy Regular Expressions tutorial


Split SSMS example

Split a String Into Words

Let's split a string into words

declare @regex_pattern varchar(max) = '\s+'

select *
from dbo.RegexSplit('How do I split an arbitrary string into words?', @regex_pattern)

select *
from dbo.RegexSplit('Does this work if   the words are oddly-formed?', @regex_pattern)