Skip to content

Latest commit

 

History

History
60 lines (51 loc) · 3.02 KB

search-text-with-regular-expressions.md

File metadata and controls

60 lines (51 loc) · 3.02 KB
title description author ms.author ms.reviewer ms.date ms.service ms.subservice ms.topic f1_keywords helpviewer_keywords monikerRange
Search text with regular expressions
Learn how to use regular expressions in the Find what field of a Find and Replace dialog box to specify a pattern to be matched.
markingmyname
maghan
randolphwest
03/20/2023
sql
ssms
conceptual
vswildcardsbuilder
vsregexbuilder
searches [SQL Server Management Studio], wildcards
Query Editor [SQL Server Management Studio], wildcard searches
wildcard options [SQL Server Management Studio]
searches [SQL Server Management Studio], regular expressions
Query Editor [SQL Server Management Studio], regular expression searches
regular expression options [SQL Server Management Studio]
searches [SQL Server Management Studio], regex
Query Editor [SQL Server Management Studio], regex searches
regex options [SQL Server Management Studio]
>=aps-pdw-2016||=azuresqldb-current||=azure-sqldw-latest||>=sql-server-2016||>=sql-server-linux-2017||=azuresqldb-mi-current

Search text with regular expressions

[!INCLUDESQL Server Azure SQL Database Synapse Analytics PDW]

The following regular expressions can replace characters or digits in the Find what field of the [!INCLUDEssManStudioFull] Find and Replace dialog box.

Search using regular expressions

  1. To enable the use of regular expressions in the Find what field during Quick Find, Find in Files, Quick Replace, or Replace in Files operations, select the Use option under Find Options and then choose Use Regular Expressions.

  2. The Expression Builder button next to the Find what field then becomes available. Select this button to display a list of the available regular expressions. When you choose any item from the Expression Builder, it is inserted into the Find what string.

The following table describes the regular expressions available in the Expression Builder.

Expression Description
. Match any single character (except a line break)
.* Match any character zero or more times
.+ Match any character one or more times
[abc] Match any character in the set abc
[^abc] Match any character not in the set abc
\d Match any numeric character
(?([^\r\n])\s) Match any whitespace character
\b Match at beginning or end of word
^ Match at beginning of line
.$ Match any line break
\w\r?\n Match a word character at end of line
`(dog cat)`
`(?dog cat)`

See also