<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Pattern Matching &#8211; Database Research &amp; Development</title>
	<atom:link href="https://www.dbrnd.com/tag/pattern-matching/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.dbrnd.com</link>
	<description>BIGData &#124; NoSQL &#124; MSSQL &#124; MySQL &#124; PostgreSQL</description>
	<lastBuildDate>Wed, 28 Feb 2018 02:16:04 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.0.6</generator>
	<item>
		<title>SQL Server: Create Full Text Search Index, Use CONTAINS for pattern matching</title>
		<link>https://www.dbrnd.com/2018/03/sql-server-create-full-text-search-index-use-contains-for-pattern-matching/</link>
					<comments>https://www.dbrnd.com/2018/03/sql-server-create-full-text-search-index-use-contains-for-pattern-matching/#comments</comments>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Sat, 03 Mar 2018 16:16:26 +0000</pubDate>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[contains]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[dbrnd]]></category>
		<category><![CDATA[Full Text Search]]></category>
		<category><![CDATA[Pattern Matching]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Server Administrator]]></category>
		<category><![CDATA[SQL Server Error]]></category>
		<category><![CDATA[SQL Server Monitoring]]></category>
		<category><![CDATA[SQL Server Performance Tuning]]></category>
		<category><![CDATA[SQL Server Programming]]></category>
		<category><![CDATA[SQL Server Tips and Tricks]]></category>
		<category><![CDATA[TSQL]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=7176</guid>

					<description><![CDATA[In this post, I am sharing the use of CONTAINS for matching the patterns in SQL Server. We know about the LIKE predicate which we are using for a specific type of pattern matching. SQL Server Full-Text Search Index stores the different patterns of the defined column. We can employ CONTAINS on the column of [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><a class="a2a_button_facebook" href="https://www.addtoany.com/add_to/facebook?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2018%2F03%2Fsql-server-create-full-text-search-index-use-contains-for-pattern-matching%2F&amp;linkname=SQL%20Server%3A%20Create%20Full%20Text%20Search%20Index%2C%20Use%20CONTAINS%20for%20pattern%20matching" title="Facebook" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_twitter" href="https://www.addtoany.com/add_to/twitter?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2018%2F03%2Fsql-server-create-full-text-search-index-use-contains-for-pattern-matching%2F&amp;linkname=SQL%20Server%3A%20Create%20Full%20Text%20Search%20Index%2C%20Use%20CONTAINS%20for%20pattern%20matching" title="Twitter" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_linkedin" href="https://www.addtoany.com/add_to/linkedin?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2018%2F03%2Fsql-server-create-full-text-search-index-use-contains-for-pattern-matching%2F&amp;linkname=SQL%20Server%3A%20Create%20Full%20Text%20Search%20Index%2C%20Use%20CONTAINS%20for%20pattern%20matching" title="LinkedIn" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pinterest" href="https://www.addtoany.com/add_to/pinterest?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2018%2F03%2Fsql-server-create-full-text-search-index-use-contains-for-pattern-matching%2F&amp;linkname=SQL%20Server%3A%20Create%20Full%20Text%20Search%20Index%2C%20Use%20CONTAINS%20for%20pattern%20matching" title="Pinterest" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_reddit" href="https://www.addtoany.com/add_to/reddit?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2018%2F03%2Fsql-server-create-full-text-search-index-use-contains-for-pattern-matching%2F&amp;linkname=SQL%20Server%3A%20Create%20Full%20Text%20Search%20Index%2C%20Use%20CONTAINS%20for%20pattern%20matching" title="Reddit" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pocket" href="https://www.addtoany.com/add_to/pocket?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2018%2F03%2Fsql-server-create-full-text-search-index-use-contains-for-pattern-matching%2F&amp;linkname=SQL%20Server%3A%20Create%20Full%20Text%20Search%20Index%2C%20Use%20CONTAINS%20for%20pattern%20matching" title="Pocket" rel="nofollow noopener" target="_blank"></a><a class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fwww.dbrnd.com%2F2018%2F03%2Fsql-server-create-full-text-search-index-use-contains-for-pattern-matching%2F&#038;title=SQL%20Server%3A%20Create%20Full%20Text%20Search%20Index%2C%20Use%20CONTAINS%20for%20pattern%20matching" data-a2a-url="https://www.dbrnd.com/2018/03/sql-server-create-full-text-search-index-use-contains-for-pattern-matching/" data-a2a-title="SQL Server: Create Full Text Search Index, Use CONTAINS for pattern matching"></a></p><p>In this post, I am sharing the use of CONTAINS for matching the patterns in SQL Server. </p>
<p>We know about the LIKE predicate which we are using for a specific type of pattern matching. SQL Server Full-Text Search Index stores the different patterns of the defined column. </p>
<p>We can employ CONTAINS on the column of Full-Text Search and can search different patterns. </p>
<p><strong>Please check the below demonstrations:</strong></p>
<p><strong>Create a table with sample records:</strong></p>
<pre class="crayon-plain-tag">CREATE TABLE tbl_Employee (empid int not null, ename varchar(20) not null, salary int)
GO

INSERT INTO tbl_Employee VALUES 
(1,'abc',25000),(2,'xyz',30000),(3,'svq',40000)
,(4,'cvq',26000),(5,'rfq',70000),(6,'opq',45000)
GO</pre> </p>
<p><strong>Create a Full Text Search Index:</strong></p>
<pre class="crayon-plain-tag">CREATE UNIQUE INDEX uk_empid ON tbl_Employee(empid);
  
CREATE FULLTEXT CATALOG ft AS DEFAULT; 

CREATE FULLTEXT INDEX ON tbl_Employee(ename)   
   KEY INDEX uk_empid   
   WITH STOPLIST = SYSTEM;</pre> </p>
<p><strong>Use CONTAINS, for performing FULL Text Search:</strong><br />
Check the below sample use of CONTAINS, If you want to use the same thing using LIKE then we have to write LIKE separately for each pattern. </p>
<pre class="crayon-plain-tag">SELECT *FROM [dbo].[tbl_Employee]
WHERE CONTAINS(ename, '"a*" OR "s*" OR "cv*"')</pre> </p>
<p><strong>Result:</strong></p>
<pre class="crayon-plain-tag">empid       ename                salary
----------- -------------------- -----------
1           abc                  25000
3           svq                  40000
4           cvq                  26000</pre> </p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.dbrnd.com/2018/03/sql-server-create-full-text-search-index-use-contains-for-pattern-matching/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
		<item>
		<title>PostgreSQL: SIMILAR operator for pattern matching</title>
		<link>https://www.dbrnd.com/2017/12/postgresql-similar-operator-for-pattern-matching/</link>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Wed, 06 Dec 2017 16:16:38 +0000</pubDate>
				<category><![CDATA[PostgreSQL]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[dbrnd]]></category>
		<category><![CDATA[LIKE]]></category>
		<category><![CDATA[Pattern Matching]]></category>
		<category><![CDATA[plpgsql]]></category>
		<category><![CDATA[Postgres Query]]></category>
		<category><![CDATA[postgresql]]></category>
		<category><![CDATA[PostgreSQL Administrator]]></category>
		<category><![CDATA[PostgreSQL Error]]></category>
		<category><![CDATA[PostgreSQL Monitoring]]></category>
		<category><![CDATA[PostgreSQL Performance Tuning]]></category>
		<category><![CDATA[PostgreSQL Programming]]></category>
		<category><![CDATA[PostgreSQL Tips and Tricks]]></category>
		<category><![CDATA[SIMILAR]]></category>
		<category><![CDATA[String Matching]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=6738</guid>

					<description><![CDATA[In this post, I am sharing the use of SIMILAR operator which uses for pattern matching in PostgreSQL. We know about the LIKE operator, the use of SIMILAR is also very similar to LIKE. The only difference is, it interprets the pattern using the SQL standard&#8217;s definition of a regular expression. Below are few examples [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><a class="a2a_button_facebook" href="https://www.addtoany.com/add_to/facebook?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2017%2F12%2Fpostgresql-similar-operator-for-pattern-matching%2F&amp;linkname=PostgreSQL%3A%20SIMILAR%20operator%20for%20pattern%20matching" title="Facebook" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_twitter" href="https://www.addtoany.com/add_to/twitter?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2017%2F12%2Fpostgresql-similar-operator-for-pattern-matching%2F&amp;linkname=PostgreSQL%3A%20SIMILAR%20operator%20for%20pattern%20matching" title="Twitter" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_linkedin" href="https://www.addtoany.com/add_to/linkedin?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2017%2F12%2Fpostgresql-similar-operator-for-pattern-matching%2F&amp;linkname=PostgreSQL%3A%20SIMILAR%20operator%20for%20pattern%20matching" title="LinkedIn" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pinterest" href="https://www.addtoany.com/add_to/pinterest?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2017%2F12%2Fpostgresql-similar-operator-for-pattern-matching%2F&amp;linkname=PostgreSQL%3A%20SIMILAR%20operator%20for%20pattern%20matching" title="Pinterest" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_reddit" href="https://www.addtoany.com/add_to/reddit?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2017%2F12%2Fpostgresql-similar-operator-for-pattern-matching%2F&amp;linkname=PostgreSQL%3A%20SIMILAR%20operator%20for%20pattern%20matching" title="Reddit" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pocket" href="https://www.addtoany.com/add_to/pocket?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2017%2F12%2Fpostgresql-similar-operator-for-pattern-matching%2F&amp;linkname=PostgreSQL%3A%20SIMILAR%20operator%20for%20pattern%20matching" title="Pocket" rel="nofollow noopener" target="_blank"></a><a class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fwww.dbrnd.com%2F2017%2F12%2Fpostgresql-similar-operator-for-pattern-matching%2F&#038;title=PostgreSQL%3A%20SIMILAR%20operator%20for%20pattern%20matching" data-a2a-url="https://www.dbrnd.com/2017/12/postgresql-similar-operator-for-pattern-matching/" data-a2a-title="PostgreSQL: SIMILAR operator for pattern matching"></a></p><p>In this post, I am sharing the use of SIMILAR operator which uses for pattern matching in PostgreSQL. </p>
<p>We know about the LIKE operator, the use of SIMILAR is also very similar to LIKE.<br />
The only difference is, it interprets the pattern using the SQL standard&#8217;s definition of a regular expression.</p>
<p>Below are few examples of SIMILAR:</p>
<p><strong>Create sample table with data:</strong></p>
<pre class="crayon-plain-tag">CREATE TABLE tbl_Stud (Rno int, Name character varying);

INSERT INTO tbl_Stud
VALUES (1,'Anvesh'), (2,'Anil')
,(3,'Roy'), (4,'Reyan'),(5,'Rohit');</pre> </p>
<p><strong>Test few example of SIMILAR:</strong></p>
<pre class="crayon-plain-tag">SELECT *FROM tbl_Stud
WHERE Name SIMILAR TO 'Anvesh';

 rno |  name
-----+--------
   1 | Anvesh


SELECT *FROM tbl_Stud
WHERE Name SIMILAR TO 'An%';

 rno |  name
-----+--------
   1 | Anvesh
   2 | Anil

SELECT *FROM tbl_Stud
WHERE Name SIMILAR TO '%n%';

 rno |  name
-----+--------
   1 | Anvesh
   2 | Anil
   4 | Reyan

SELECT *FROM tbl_Stud
WHERE Name SIMILAR TO '%(An|Ro)%';

 rno |  name
-----+--------
   1 | Anvesh
   2 | Anil
   3 | Roy
   5 | Rohit</pre> </p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
