[MXS-580] Adding extended regular expressions support for QLA Filter Created: 2016-02-12  Updated: 2017-12-01  Resolved: 2016-02-25

Status: Closed
Project: MariaDB MaxScale
Component/s: qlafilter
Affects Version/s: None
Fix Version/s: 1.4.0

Type: New Feature Priority: Major
Reporter: Diego Alonso Assignee: markus makela
Resolution: Fixed Votes: 0
Labels: None


 Description   

Adding extended regular expressions support to the QLA Filter would allow more useful operators like "|" that will match either of its arguments, for example "update|delete" will match either "update" or "delete" query statements.

The changes to implement this seem pretty straight forward:

--- a/server/modules/filter/qlafilter.c
+++ b/server/modules/filter/qlafilter.c
@@ -227,7 +227,7 @@ createInstance(char **options, FILTER_PARAMETER **params)
         }
         my_instance->sessions = 0;
         if (my_instance->match &&
-            regcomp(&my_instance->re, my_instance->match, REG_ICASE))
+            regcomp(&my_instance->re, my_instance->match, REG_EXTENDED | REG_ICASE))
         {
             MXS_ERROR("qlafilter: Invalid regular expression '%s'"
                       " for the match parameter.\n",
@@ -243,7 +243,7 @@ createInstance(char **options, FILTER_PARAMETER **params)
         }
         if (my_instance->nomatch &&
             regcomp(&my_instance->nore, my_instance->nomatch,
-                    REG_ICASE))
+                    REG_EXTENDED | REG_ICASE))
         {
             MXS_ERROR("qlafilter: Invalid regular expression '%s'"
                       " for the nomatch paramter.",



 Comments   
Comment by markus makela [ 2016-02-25 ]

The qlafilter, topfilter and namedserverfilter now accept extended as a parameter which enables the ERE mode.

Comment by markus makela [ 2016-02-25 ]

In the future PCRE2 should be used instead since it is already bundled with MaxScale.

Comment by Diego Alonso [ 2016-02-25 ]

Great stuff, thanks! Agreed with PCRE2 for future changes.

Generated at Thu Feb 08 04:00:23 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.