Is there a way to update every email address in MySQL with regexp? What I want to do is to change something@domain.xx addresses to something@domain.yy. Is it possible to do with SQL or should I do it with PHP for example?
Thanks!
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can search for a
REGEXPwithMySQL, but, unfortunately, it cannot return the matched part.It’s possible to do it with
SQLas follows:You can omit the
WHEREclause, but it could lead to unexpected results (like@example.xxx.comwill be replaced with@example.yyx.com), so it’s better to leave it.