esedic
2/22/2016 - 6:01 PM

Userfule regular expression snippets

Useful regular expression snippets

// Replace everything between double quotes
// Example: title="Lorem Ipsum" will return title=""
title="[^"]*"

// 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%';