Useful regular expression snippets
// Replace everything between double quotes
// Example: title="Lorem Ipsum" will return title=""
title="[^"]*"
// Replace everything between style tags
(?s)<style(.*?)</style>
// Replace everything between HTML tags (<pre> in this example)
(?<=(<pre>))(\w|\d|\n|[().,\-:;@#$%^&*\[\]"'+–/\/®°⁰!?{}|`~]| )+?(?=(</pre>))
// Replace everything between brackets (parenthesis)
\([^)]*\)
// remove script tags
<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>
// Replace part of the string
// Example: SET `id` = 198545,`introtext` will return SET `id` = ,`introtext`
SET `id` = (.*?),`introtext`
// Find termination character (\0) in mysql table
select * from TABLE where COLUMN like '%\0%';
<div([\s\S]*?)> matches the div start tag, even if the tag spans several lines.