<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title>Tech-Recipes - Latest Comments in Use regular expressions in MySQL SELECT statements</title><link>http://tech-recipes.disqus.com/</link><description>Cookbook of Tech Tutorials</description><atom:link href="https://tech-recipes.disqus.com/use_regular_expressions_in_mysql_select_statements_mysql_tech_recipes/latest.rss" rel="self"></atom:link><language>en</language><lastBuildDate>Sat, 06 Aug 2011 10:40:32 -0000</lastBuildDate><item><title>Re: Use regular expressions in MySQL SELECT statements</title><link>http://www.tech-recipes.com/rx/484/use-regular-expressions-in-mysql-select-statements/#comment-279209019</link><description>&lt;p&gt;I think you use the ^ character to negate stuff: &lt;br&gt;[^a-z]&lt;br&gt;would find anything that wasn't a to z.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Asdfasd</dc:creator><pubDate>Sat, 06 Aug 2011 10:40:32 -0000</pubDate></item><item><title>Re: Use regular expressions in MySQL SELECT statements</title><link>http://www.tech-recipes.com/rx/484/use-regular-expressions-in-mysql-select-statements/#comment-217998644</link><description>&lt;p&gt;sepp du bist der depp&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Hallo</dc:creator><pubDate>Sat, 04 Jun 2011 01:01:49 -0000</pubDate></item><item><title>Re: Use regular expressions in MySQL SELECT statements</title><link>http://www.tech-recipes.com/rx/484/use-regular-expressions-in-mysql-select-statements/#comment-191958881</link><description>&lt;p&gt;sepp&lt;br&gt;&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Gasr</dc:creator><pubDate>Tue, 26 Apr 2011 05:46:30 -0000</pubDate></item><item><title>Re: Use regular expressions in MySQL SELECT statements</title><link>http://www.tech-recipes.com/rx/484/use-regular-expressions-in-mysql-select-statements/#comment-178570421</link><description>&lt;p&gt;Could also use the '+' operator to match one or more o's ...&lt;/p&gt;&lt;p&gt;select "hellooo" REGEXP "^h[el]+o+$"&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Andy Mason</dc:creator><pubDate>Tue, 05 Apr 2011 12:23:46 -0000</pubDate></item><item><title>Re: Use regular expressions in MySQL SELECT statements</title><link>http://www.tech-recipes.com/rx/484/use-regular-expressions-in-mysql-select-statements/#comment-162915258</link><description>&lt;p&gt;was geht denn mitr dir&lt;br&gt;&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Josef Schalk</dc:creator><pubDate>Wed, 09 Mar 2011 05:25:56 -0000</pubDate></item><item><title>Re: Use regular expressions in MySQL SELECT statements</title><link>http://www.tech-recipes.com/rx/484/use-regular-expressions-in-mysql-select-statements/#comment-162915060</link><description>&lt;p&gt;moang&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Jo</dc:creator><pubDate>Wed, 09 Mar 2011 05:24:34 -0000</pubDate></item><item><title>Re: Use regular expressions in MySQL SELECT statements</title><link>http://www.tech-recipes.com/rx/484/use-regular-expressions-in-mysql-select-statements/#comment-154502176</link><description>&lt;p&gt;hi&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">viji</dc:creator><pubDate>Wed, 23 Feb 2011 04:00:46 -0000</pubDate></item><item><title>Re: Use regular expressions in MySQL SELECT statements</title><link>http://www.tech-recipes.com/rx/484/use-regular-expressions-in-mysql-select-statements/#comment-152966053</link><description>&lt;p&gt;ach sepp&lt;br&gt;&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Ojio</dc:creator><pubDate>Sun, 20 Feb 2011 06:47:48 -0000</pubDate></item><item><title>Re: Use regular expressions in MySQL SELECT statements</title><link>http://www.tech-recipes.com/rx/484/use-regular-expressions-in-mysql-select-statements/#comment-152962638</link><description>&lt;p&gt;vwpanzersepp&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Nikn</dc:creator><pubDate>Sun, 20 Feb 2011 06:21:52 -0000</pubDate></item><item><title>Re: Use regular expressions in MySQL SELECT statements</title><link>http://www.tech-recipes.com/rx/484/use-regular-expressions-in-mysql-select-statements/#comment-152566230</link><description>&lt;p&gt;like und dann %&lt;br&gt;seppelinsepp&lt;br&gt;mcsepp&lt;br&gt;fußballsepp&lt;br&gt;keyboardsepp&lt;br&gt;radfahrersepp&lt;br&gt;sepp du depp&lt;br&gt;&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Sepp-seppelin_constructions</dc:creator><pubDate>Sat, 19 Feb 2011 12:30:12 -0000</pubDate></item><item><title>Re: Use regular expressions in MySQL SELECT statements</title><link>http://www.tech-recipes.com/rx/484/use-regular-expressions-in-mysql-select-statements/#comment-152563374</link><description>&lt;p&gt;sepp du depp&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Gas</dc:creator><pubDate>Sat, 19 Feb 2011 12:25:33 -0000</pubDate></item><item><title>Re: Use regular expressions in MySQL SELECT statements</title><link>http://www.tech-recipes.com/rx/484/use-regular-expressions-in-mysql-select-statements/#comment-82144939</link><description>&lt;p&gt;How to select from a column that not have character? like in php !preg_match('/[a-z]/i')&lt;br&gt;&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">GHead</dc:creator><pubDate>Wed, 29 Sep 2010 18:36:27 -0000</pubDate></item><item><title>Re: Use regular expressions in MySQL SELECT statements</title><link>http://www.tech-recipes.com/rx/484/use-regular-expressions-in-mysql-select-statements/#comment-66171717</link><description>&lt;p&gt;whoooooo... that's cool!&lt;/p&gt;&lt;p&gt;so anywa, how about we just want to select N until M row only?&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Gumuruh S</dc:creator><pubDate>Thu, 05 Aug 2010 06:17:25 -0000</pubDate></item><item><title>Re: Use regular expressions in MySQL SELECT statements</title><link>http://www.tech-recipes.com/rx/484/use-regular-expressions-in-mysql-select-statements/#comment-28916532</link><description>&lt;p&gt;@Wayne&lt;/p&gt;&lt;p&gt;I ran the following queries three times each on my MySQL database which has over 200,000 articles in it:&lt;/p&gt;&lt;p&gt;SELECT * FROM `mos_content` WHERE title REGEXP 'article';&lt;br&gt;SELECT * FROM `mos_content` WHERE title LIKE '%article%';&lt;/p&gt;&lt;p&gt;REGEXP averaged 0.047333333 seconds&lt;br&gt;LIKE averaged 0.035333333 seconds&lt;/p&gt;&lt;p&gt;There was hardly any deviation between the runs. But it's obvious that LIKE is about 25% faster than REGEXP for some reason (at least on my specific MySQL configuration).&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">gilahacker</dc:creator><pubDate>Fri, 08 Jan 2010 13:29:27 -0000</pubDate></item><item><title>Re: Use regular expressions in MySQL SELECT statements</title><link>http://www.tech-recipes.com/rx/484/use-regular-expressions-in-mysql-select-statements/#comment-28800472</link><description>&lt;p&gt;I've been using mySQL for years, and I've been using regular expressions for years. Yet, somehow, I never found out until just now (from this recipe) that mySQL supported them in a manner like this. That's amazingly useful. Thank you!&lt;/p&gt;&lt;p&gt;(Of course, I also see that you wrote this recipe almost six years ago - so thank you for six years ago!)  :)&lt;/p&gt;&lt;p&gt;Does REGEXP have a bigger or smaller or identical performance hit when compared to using LIKE for substrings?&lt;/p&gt;&lt;p&gt;For instance, here's a couple pairs of otherwise equivalent queries. Within each pair, which would be better for performance?&lt;br&gt;SELECT * FROM events WHERE id REGEXP 'abcd'&lt;br&gt;SELECT * FROM events WHERE id like '%abcd%'&lt;/p&gt;&lt;p&gt;SELECT * FROM events WHERE id REGEXP 'abcd.*lmnop'&lt;br&gt;SELECT * FROM events WHERE id like '%abcd%lmnop%'&lt;/p&gt;&lt;p&gt;Is LIKE just a specialize synonym for REGEXP which actually uses REGEXP in the background, or is it truly it's own function?  (Asked because if it uses REGEXP, then the performance hits should be identical within both those pairs.)&lt;/p&gt;&lt;p&gt;Anyway, thanks again for adding a weapon to my arsenal that should have been there years ago. I can't imagine how I've overlooked it for so long.&lt;/p&gt;&lt;p&gt;w&lt;br&gt;&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Wayne</dc:creator><pubDate>Thu, 07 Jan 2010 13:33:40 -0000</pubDate></item><item><title>Re: Use regular expressions in MySQL SELECT statements</title><link>http://www.tech-recipes.com/rx/484/use-regular-expressions-in-mysql-select-statements/#comment-25531437</link><description>&lt;p&gt;santoshb,&lt;/p&gt;&lt;p&gt;i don't know if you have the answer to your question yet, but your regexp is only look for one 'o'. The $ sign means the absolute end of the string.&lt;/p&gt;&lt;p&gt;You could either do:&lt;/p&gt;&lt;p&gt;^h[el]+o&lt;/p&gt;&lt;p&gt;or..&lt;/p&gt;&lt;p&gt;^h[el]+ooo$&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Shane</dc:creator><pubDate>Fri, 11 Dec 2009 12:58:04 -0000</pubDate></item><item><title>Re: Use regular expressions in MySQL SELECT statements</title><link>http://www.tech-recipes.com/rx/484/use-regular-expressions-in-mysql-select-statements/#comment-22880449</link><description>&lt;p&gt;may i know Why this query showing false result&lt;/p&gt;&lt;p&gt; select "hellooo" REGEXP "^h[el]+o$";&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">santoshb</dc:creator><pubDate>Fri, 13 Nov 2009 00:33:21 -0000</pubDate></item><item><title>Re: Use regular expressions in MySQL SELECT statements</title><link>http://www.tech-recipes.com/rx/484/use-regular-expressions-in-mysql-select-statements/#comment-12267314</link><description>&lt;p&gt;Is there a way to use regexp when defining a table to SELECT $something from? &lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">////AE</dc:creator><pubDate>Tue, 07 Jul 2009 14:05:57 -0000</pubDate></item><item><title>Re: Use regular expressions in MySQL SELECT statements</title><link>http://www.tech-recipes.com/rx/484/use-regular-expressions-in-mysql-select-statements/#comment-7244151</link><description>&lt;p&gt;Thank you&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Lawrence</dc:creator><pubDate>Sun, 15 Mar 2009 18:56:54 -0000</pubDate></item></channel></rss>