SQL 2008 R2 regular expressions

Figured by now SQL 2008 R2 should have regular expressions, and it doesn’t quite, but it can. Here’s two of the ways you might do this:

1. Use MDS … it’s an add in for SQL 2008 R2.  Assuming you are running x64, , have IIS, .net 3.5 or later etc., you can install MasterDataServices (hidden in plain site on the install DVD or ISO) .. look in the directory:
<drive>\MasterDataServices\x64\1033_ENU
and execute:
MasterdataServices.msi

this MSDN link will tell you more:
http://msdn.microsoft.com/en-us/library/ee633763.aspx

but for a great step by run down of the step install, that’s simple you might also see:
http://thefirstsql.com/2011/02/08/how-to-enable-master-data-services-mds-in-sql-server-2008-r2/

you can add the MDS functions into another database using this:
http://www.pettijohn.com/2010/08/regular-expressions-in-sql-2008-r2.html

more info on using the MDS functions themselves:
http://thefirstsql.com/2011/02/07/regular-expressions-advanced-string-matching-and-new-split-function-sql-server-2008-r2/

2. Add (or create) your own CLR implementation of Regex functions, for example:
http://msdn.microsoft.com/en-us/magazine/cc163473.aspx

haven’t done this one yet, more later ..

Advertisements