Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Complete Regex syntax for Sql Server Management Studio

Is there a complete description of the regular expression syntax used in Sql Server Management Studio? There must be a way to do negative lookaheads, for example, but the find/replace dialog doesn't list one.

like image 710
agent-j Avatar asked Jun 24 '11 15:06

agent-j


People also ask

Can you use RegEx in SSMS?

You can specify precise and complex expressions using regex to find and replace various strings and patterns. In tools, such as SSMS, you can specify the regex patterns in the Find What and Find and Replace options.

Can I use RegEx in SQL Server?

Regular expressions are a concise and flexible notation for finding and replacing patterns of text. A specific set of regular expressions can be used in the Find what field of the SQL Server Management Studio Find and Replace dialog box.

Does SQL like use RegEx?

We use regular expressions to define specific patterns in T-SQL in a LIKE operator and filter results based on specific conditions. We also call these regular expressions as T-SQL RegEx functions. In this article, we will use the term T-SQL RegEx functions for regular expressions.


1 Answers

SSMS versions 2005-2012 are really just modified/customized Visual Studio Shell (2005-2010) environments, so this Visual Studio (2005-2010) Regular Expression reference applies:

http://msdn.microsoft.com/en-us/library/2k3te2cs(v=vs.80).aspx

Visual Studio 2012 and later have switched to standard .Net regular expressions.

However SSMS did not follow suit and adapt standard regular expressions until SSMS 2016.

like image 74
Tao Avatar answered Oct 10 '22 17:10

Tao