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 Answer
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!