Mysql throwing exception on Regex

This works:

mysql> SELECT '123456789' REGEXP '.{3}';#1

mysql> SELECT '123456789' REGEXP '.{10}';#2

but not this:

mysql> SELECT * FROM mymodel WHERE some_text_field REGEXP '.{100}';#3

throwing exception: ERROR 1139 (42000): Got error 'invalid repetition count(s)' from regexp

Answers


It means you don't have a string which is 100 characters or more in this field. You could try this instead, if you just want to check this condition:

SELECT * FROM mymodel WHERE LENGTH(some_text_field) = 100 ;

Need Your Help

UTF8 characters from database don't show up properly in the browser - MySQL & PHP CodeIgniter

php codeigniter utf-8 character-encoding amazon-ec2

My database and tables are set to utf8_general_ci collation and utf8 charset. CodeIgniter is set to utf8. I've added meta tag charset=utf8, and I'm still getting something like: квартиры in...

Make an AtomicXXX object volatile

java concurrency atomicity

I have read some info about volatile variables and their AtomicXXX counterparts, (e.g. AtomicBoolean).

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.