1

I am using the MariaDB Server Version 5.5 which is under my production server
and in local I am using MariaDB 10.1

Now I am trying to use the REGEXP_REPLACE function in local it's working fine, but when I used to in production server I got REGEXP_REPLACE function not exist Error

Then I came to knew REGEXP_REPLACE function will be support only for MariaDB 10.0.5 and above versions.

Is there any way to reach the REGEXP_REPLACE functionality under the 5.5 version?

2
  • 1
    Generally speaking: If a function does not exist in your DB server version, you can't make it available. Specifically speaking: Please include a representative example of the data you want to modify, along with the regex you are currently using. Maybe the existing string functions can be used to achieve the same result. Commented Nov 14, 2016 at 14:24
  • 1
    And this is a prime example of why development environments should closely mirror production environments. Commented Nov 18, 2016 at 12:35

2 Answers 2

1

I don't think there is any option in 5.5!

You could however check the steps needed to upgrade from 5.5 to 10.

The other, non recommended option would to search for regex inside sql and do the regex replacing inside the application code.

Sign up to request clarification or add additional context in comments.

Comments

1

Yes, you can achieve that using User Defined Functions (or, UDF for short). You need to be familiar with C/C++ development though. You compile a shared library / DLL, drop it into plugin directory, execute CREATE FUNCTION ... SONAME myfunc.so, and you extended MySQL.

https://dev.mysql.com/doc/refman/5.6/en/adding-udf.html provides description of the process, and the source code has an example for some UDFs , e.g here https://github.com/MariaDB/server/blob/10.1/sql/udf_example.c

Of course this is only appropriate, if it is not easy write stored function with the same functionality in SQL (which I'd say is true in this case)

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.