SQL Server Regular expressions in T-SQL

regex, sql-server, t-sql

Solution

How about the PATINDEX function?

The pattern matching in TSQL is not a complete regex library, but it gives you the basics.

(From Books Online)

Wildcard  Meaning  
% Any string of zero or more characters.

_ Any single character.

[ ] Any single character within the specified range 
    (for example, [a-f]) or set (for example, [abcdef]).

[^] Any single character not within the specified range 
    (for example, [^a - f]) or set (for example, [^abcdef]).

Problem

Is there any regular expression library written in T-SQL (no CLR, no extended `SP`, pure T-SQL) for SQL Server, and that should work with shared hosting? Edit: - Thanks, I know about `PATINDEX`, `LIKE`, `xp_` `sps` and CLR solutions - I also know it is not the best place for regex, the question is theoretical :) - Reduced functionality is also accepted

Original source