0

I know that MySQL does not have a regular expression replace function but I wondered if anyone has written a user defined function that I could use? I know it's not good to just ask for code answers but I am not very skilled in MySQL and was just looking for some help. If there isn't I can accept that.

Thanks

2

2 Answers 2

1

Try this site:

http://www.mysqludf.org/lib_mysqludf_preg/

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

2 Comments

This sounds great. It requires installing a library to use perl regex but is a valid solution.
Alternatively, see launchpad.net/mysql-udf-regexp , which was recommended in the post noted by @tadman.
0
select 
  replace( replace( replace( replace( replace( 
  replace( replace( replace( replace( replace( 
  replace( replace( replace( replace( replace( 
  replace( replace( replace( replace( replace( 
  replace( replace( replace( replace( replace( 
  replace( replace( replace( replace( replace( 
  replace( replace( replace( replace( replace( 
  replace( replace( replace(

'a~b}c{d`e_f^g\\h[i?j=k;l.m-n,o*p(q&r$s"t u|v]x@y>z<:+)\'%#!\r\f\v\naz\t09\b',

  '~', ''), '}', ''), '{', ''), '`', ''), '_', ''),
  '^', ''), '\\', ''), '[', ''), '?', ''), '=', ''),
  ';', ''), '.', ''), '-', ''), ',', ''), '*', ''),
  '(', ''), '&', ''), '$', ''), '"', ''), ' ', ''),
  '|', ''), ']', ''), '@', ''), '>', ''), '<', ''),
  ':', ''), '+', ''), ')', ''), '\'', ''), '%', ''),
  '#', ''), '!', ''), '\r', ''), '\f', ''), '\v', ''),
  '\n', ''), '\t', ''), '\b', '')

Replace

a~b}c{d`e_f^g\h[i?j=k;l.m-n,o*p(q&r$s"t u|v]x@y>z<:+)\'%#!\r\f\v\naz\t09\b

To

abcdeghijklmnopqrstuxyzaz09

MySQL - Regular Expressions & REPLACE

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.