SQL Server 2005: Regular Expressions Make Pattern Matching And Data Extraction Easier -- MSDN Magazine, February 2007
CLR User-Defined Functions
Pattern Matching
Data Extraction
Pattern Storage
Matches
Data Extraction within Matches
uses grouping to determine every distinct server stored in the Url column of the UrlTable table.
select distinct dbo.RegexGroup( [Url],
N'https?://(?([\w-]+\.)*[\w-]+)', N'server' )<BR>from [UrlTable]<BR><\/PRE><\/BODY>