Do you have a comment or suggestion to improve SQL Server? We’d love to hear it!

Add built-in support for regular expressions in T-SQL

LIKE is very limited in what it can differentiate. The CLR has much more robust handling for regular expressions, but it's hard to get to from T-SQL.

Could we add built-in functionality in T-SQL to do regular expression pattern matching?

39 votes
Sign in
(thinking…)
Sign in with: Microsoft
Signed in as (Sign out)

We’ll send you updates on this idea

AdminMicrosoft SQL Server (Product Manager, Microsoft Azure) shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →

Upvotes: 54

<=-=Sep 4 2007 12:29PM=-=>

If this is considered for a future version of SQL Server, please implement it according to the ISO SQL standard. In other words, implement the SQL Standard , which provides regular expression support through the operator [NOT] SIMILAR TO, which in the standard remains separate from LIKE.

<=-=Sep 5 2007 7:05AM=-=>

Like Steve, I would also like to stress that any implementation should be as per ANSI (SIMILAR predicate). The CLR functionality is not a relevant design consideration.

<=-=Oct 15 2007 8:43AM=-=>

This is a request we’ve heard a lot, and it’s of obvious value. I can’t promise when we’ll get to it—-it’s doubtful for this release—-but this is certainly on our radar.

Cheers,
-Isaac

<=-=Mar 24 2010 2:54PM=-=>

Hi,
I have resolved this request as duplicate of feedback item below:

https://connect.microsoft.com/SQLServer/feedback/details/261342/regex-functionality-in-pattern-matching?wa=wsignin1.0


Umachandar, SQL Programmability Team

<=-=Mar 24 2010 3:59PM=-=>

Resolved as duplicate.


Umachandar

<=-=Mar 25 2010 11:10AM=-=>

Resolved as duplicate.


Umachandar

3 comments

Sign in
(thinking…)
Sign in with: Microsoft
Signed in as (Sign out)
Submitting...
  • Eric Melcher commented  ·   ·  Flag as inappropriate

    Fully agree with Aaron. There is no way to achieve this in Azure SQL now that CLR is no longer an option.

  • Nigel commented  ·   ·  Flag as inappropriate

    It would be really useful to have full support for regular expressions in SQL Server.
    The Oracle database has supported this for many years, with functions like:
    REGEXP_LIKE, REGEXP_COUNT, REGEXP_INSTR, REGEXP_REPLACE, REGEXP_SUBSTR

  • Aaron Abdis commented  ·   ·  Flag as inappropriate

    It was possible to get this function with CLR, but we have more and more of our clients moving to cloud-hosted SQL Server instances, such as AWS, where they simply do not even have the ability to enable CLR. So CLR implementations are becoming less and less plausible.

    As such, it is becoming more and more necessary for this to be implemented in SQL Server itself, without the need for CLR.

    Pretty please, with whipped cream... and sprinkles and a cherry on top?

Feedback and Knowledge Base