0

Is it possible to check if a string variable matches a regex in SQL Server? I want something simple like @stringVariable = @regex and get as result something like true/false.

1
  • Microsoft SQL Server 2012 Commented Jan 6, 2014 at 11:27

1 Answer 1

3

Assuming you mean Microsoft SQL Sever, then you can't as it doesn't support regex out of the box.

However you could shell out the process to a CLR Stored procedure, or if it is a very simple regex, you might be able to use a LIKE keyword.

Here is a link about CLR regex support. I used this myself a few years ago until I abandoned the idea of using regex in my case!

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.