What is the correct syntax for a Regex find-and-replace using REGEXP_REPLACE in MariaDB?

前端 未结 1 352
感情败类
感情败类 2021-01-13 13:53

I need to run a regex find-and-replace against a column named message in a MySQL table named post.

My database is running MariaDB 10.

相关标签:
1条回答
  • 2021-01-13 14:50

    You have to do a lot of escaping here:

    REGEXP_REPLACE(message, "\\[quote\\sauthor=(.+)\\slink=[^\\]]+]", "\\[quote=\"\\1\"\\]")
    

    Please note that you have to reference the Group by \\1

    0 讨论(0)
提交回复
热议问题