Skip to content

Latest commit

 

History

History
24 lines (19 loc) · 863 Bytes

README.md

File metadata and controls

24 lines (19 loc) · 863 Bytes

NativeSqlRegex

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.

Examples:

IF dbo.RegexIsMatch('234-567-8901', '\d+-\d+-d+') = 1 ...

SET @areaCode = dbo.RegexMatchGroup('234-567-8901', '(\d+)-\d+-d+', 1);

Supported constructs

  • 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

References

https://msdn.microsoft.com/en-us/library/az24scfc