Skip to content

Instantly share code, notes, and snippets.

View drimcaster's full-sized avatar
😘
Always feel motivated.

Joseph Aguilar drimcaster

😘
Always feel motivated.
View GitHub Profile
@bludnic
bludnic / regexp_replace.sql
Created July 23, 2018 14:25
REGEXP_REPLACE for mysql
/* SELECT test */
SELECT ID, reg_replace(post_content, '<aside class="mashsb-container(.*)">((.|\n)*)<\/aside>', '', TRUE, 2, 0) as content
FROM wp_posts
WHERE post_content REGEXP('<aside class="mashsb-container(.*)">((.|\n)*)<\/aside>')
LIMIT 1
/* Update */
UPDATE wp_posts
SET post_content = REGEXP_REPLACE('post_content', '<aside class="mashsb-container(.*)">((.|\n)*)<\/aside>', '')
WHERE ID = 469