Bug #28164 Perl Compatible Regular Expressions (PREGEX/PRLIKE syntax)
Submitted: 30 Apr 2007 14:05 Modified: 14 Oct 2009 19:08
Reporter: Lester Hightower Email Updates:
Status: Verified Impact on me:
Category:MySQL Server: Parser Severity:S4 (Feature request)
Version:All OS:Any
Assigned to: CPU Architecture:Any
Triage: D5 (Feature request)

[30 Apr 2007 14:05] Lester Hightower
This is a feature request for Perl Compatible Regular Expressions for Mysql.  Please see http://www.pcre.org/ (the libpcre website) for a possible option for quickly implementing PCRE in Mysql.  From that website, "PCRE was originally written for the Exim MTA, but is now used by many high-profile open source projects, including Apache, PHP, KDE, Postfix, Analog, and Nmap."

It is my belief that PCREs would help many developers, like me, who have heavy regex usage in software written in a perl-compatible language -- python, C#, Java, etc. -- with data stored in mysql.  Having to use two different regex implementations (perl compatible vs. POSIX extended) causes a lot of problems, particularly for end-users, who struggle enough with regex syntax to begin with, and just get overwhelmed by perl vs. POSIX semantics.

How to repeat:

Suggested fix:
I suggest introducing PREGEX and PRLIKE SQL syntax, to denote perl-compatible regex queries while maintaining backward-compatability with existing software.
[30 Apr 2007 17:35] Valeriy Kravchuk
Thank you for a reasonable feature request.
[30 Apr 2007 18:28] Lester Hightower
A nice synopsis of PCRE can be found in Wikipedia at these two URLs (English): http://en.wikipedia.org/wiki/PCRE and http://en.wikipedia.org/wiki/Regex#Perl-compatible_regular_expressions_.28PCRE.29
[9 Jun 2009 1:17] Lester Hightower
I am adding a comment in hopes of maybe prompting some followup, as two years have past with none...
[14 Oct 2009 19:00] Breno Ribeiro
Since PHP is the closest language to MySQL...
It's interesting to know that the version 6.x no longer support Posix RE's.
[14 Oct 2009 19:08] Lester Hightower
I learned of a UDF library that implements PCRE, and thought that I would add the link here for others that may stumble across this bug report:

It would still be wonderful to have PCRE support native in MySQL, particularly in light of the recent comment about PHP6 dropping support for Posix style regular expressions.