You can do a REGEXP search using MySQL , but unfortunately it cannot return the matched part.
This can be done using SQL as follows:
UPDATE mytable SET email = REPLACE(email, '@domain.xx', '@domain.yy') WHERE email REGEXP '@domain.xx$'
You can omit the WHERE , but this may lead to unexpected results (for example, @example.xxx.com will be replaced by @example.yyx.com ), so it is better to leave it.
Quassnoi
source share