Basic regular expression support implemented in native T-SQL. Useful for environments where CLR integration is not an option.
Warning: While convenient, these functions are not blazing fast. Expect a few hundred matches per second for simple patterns. Performance tips welcome.
IF dbo.RegexIsMatch('234-567-8901', '\d+-\d+-d+') = 1 ...
SET @areaCode = dbo.RegexMatchGroup('234-567-8901', '(\d+)-\d+-d+', 1);
- Character escapes: **
- Character classes: \s \d \w .
- Anchors: not supported yet
- Grouping: (subexpression)
- Quantifiers: ? * + (exact and/or lazy quantifiers not supported yet)
- Backreference: not supported yet
- Alternation: not supported yet
- Substitution: not supported yet