Skip to content

Instantly share code, notes, and snippets.

@geraldurbas
Created November 8, 2024 22:26
Show Gist options
  • Save geraldurbas/0af131713416e40cdfa3bc363c63a344 to your computer and use it in GitHub Desktop.
Save geraldurbas/0af131713416e40cdfa3bc363c63a344 to your computer and use it in GitHub Desktop.
SQL: replace Lightspeed Webshop URLs in WooCommerce Exported Products
SELECT post_content,
REGEXP_REPLACE(post_content, 'https://static\\.webshopapp\\.com/shops/1234/files/[0-9]+/', 'https://new-url.com/fixed/path/')
FROM `db606006_1`.`eucph_posts`
WHERE
post_content REGEXP 'https://static\\.webshopapp\\.com/shops/1234/[^\"\\s]*';
EXPLAIN UPDATE eucph_posts
SET post_content = REGEXP_REPLACE(post_content, 'https://static\\.webshopapp\\.com/shops/1234/files/[0-9]+/', 'https://rechtwp.de/wp-content/uploads/2024/11/')
WHERE post_content REGEXP 'https://static\\.webshopapp\\.com/shops/1234/[^\"\\s]*';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment