Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-6027

RLIKE: "." no longer matching new line

Details

    • Bug
    • Status: Closed (View Workflow)
    • Critical
    • Resolution: Fixed
    • 10.0.10
    • 10.0.11
    • None
    • None
    • Windows 8, Windows Server 2012 R2, maybe others

    Description

      In 5.5.36, RLIKE and REGEXP work as they always have:

      SELECT 
      'cat and
       dog' 
      RLIKE 'cat.*dog';
      => 1
       
      In 10.0.10, 
      SELECT 
      'cat and
       dog' 
      RLIKE 'cat.*dog';
      => 0

      I consider this to be a critical issue that would cause queries to not function as expected.

      Attachments

        Activity

          elenst Elena Stepanova added a comment - - edited

          Apparently the difference was caused by switching to PCRE.

          elenst Elena Stepanova added a comment - - edited Apparently the difference was caused by switching to PCRE.
          elenst Elena Stepanova added a comment - - edited

          With PCRE, to have the dot to matchi a new line character, option (?s) should be set:

          MariaDB [test]> SELECT  'cat and                              
           dog'  RLIKE '(?s)cat.*dog';
          +--------------------------------------+
          | 'cat and
           dog'  RLIKE '(?s)cat.*dog' |
          +--------------------------------------+
          |                                    1 |
          +--------------------------------------+
          1 row in set (0.00 sec)

          See https://mariadb.com/kb/en/pcre-regular-expressions/#option-setting .

          It's still not very good that the default behavior changed.

          elenst Elena Stepanova added a comment - - edited With PCRE, to have the dot to matchi a new line character, option (?s) should be set: MariaDB [test]> SELECT 'cat and dog' RLIKE '(?s)cat.*dog' ; + --------------------------------------+ | 'cat and dog' RLIKE '(?s)cat.*dog' | + --------------------------------------+ | 1 | + --------------------------------------+ 1 row in set (0.00 sec) See https://mariadb.com/kb/en/pcre-regular-expressions/#option-setting . It's still not very good that the default behavior changed.

          Maybe that option should be enabled by default, and using (?-s) would disable it.

          Jorge Silva Jorge Manuel Silva added a comment - Maybe that option should be enabled by default, and using (?-s) would disable it.

          On the other hand, it would be good to be as close to the "normal" pcre behavior as possible, users that know pcre shouldn't need to read mariadb manual to know all mariadb specific pcre quirks.

          bar, perhaps we could add, like, @@default_regex_flags variable? This will keep pcre "normal behavior" in mariadb and won't change defaults post-GA, but users of old applications would be able to set 's' flag to be on by default.

          serg Sergei Golubchik added a comment - On the other hand, it would be good to be as close to the "normal" pcre behavior as possible, users that know pcre shouldn't need to read mariadb manual to know all mariadb specific pcre quirks. bar , perhaps we could add, like, @@default_regex_flags variable? This will keep pcre "normal behavior" in mariadb and won't change defaults post-GA, but users of old applications would be able to set 's' flag to be on by default.

          That would be a good idea. I agree.

          Jorge Silva Jorge Manuel Silva added a comment - That would be a good idea. I agree.

          Added a new variable @@default_regex_flags.

          To make "." match new line, one can add this command into my.cnf:

          [mysqld]
          default-regex-flags=DOTALL

          See here for more details:
          https://mariadb.com/kb/en/server-system-variables/#default_regex_flags

          bar Alexander Barkov added a comment - Added a new variable @@default_regex_flags. To make "." match new line, one can add this command into my.cnf: [mysqld] default-regex-flags=DOTALL See here for more details: https://mariadb.com/kb/en/server-system-variables/#default_regex_flags

          Pushed into 10.0.

          bar Alexander Barkov added a comment - Pushed into 10.0.

          People

            bar Alexander Barkov
            rebelde M Kellogg
            Votes:
            1 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.