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

REGEXP REPLACE backreference in a function

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Not a Bug
    • 10.1, 10.1.38, 10.2, 10.3, 10.4
    • N/A
    • Data types
    • None
    • Debian

    Description

      If i use backreference in LPAD function, in the result the padding characters number always the same (2, but why?), not depends on the padded string length:

      SELECT REGEXP_REPLACE('aaa 123 bbb 45 ccc 6 ddd', '([0-9]+)', LPAD('\\1', 4, '0'));
      

      aaa 00123 bbb 0045 ccc 006 ddd

      How can i reach this result:

      aaa 0123 bbb 0045 ccc 0006 ddd

      Attachments

        Activity

          People

            bar Alexander Barkov
            LaySoft Lay András
            Votes:
            0 Vote for this issue
            Watchers:
            4 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.