Skip to content

Instantly share code, notes, and snippets.

@frankiejarrett
Last active January 18, 2017 07:57
Show Gist options
  • Select an option

  • Save frankiejarrett/7bfe487ebdd5b1ee435a3723e079b939 to your computer and use it in GitHub Desktop.

Select an option

Save frankiejarrett/7bfe487ebdd5b1ee435a3723e079b939 to your computer and use it in GitHub Desktop.
Detect serialized data with regex in MySQL - https://regex101.com/r/mXyzmI/2
/* Select rows that contain serialized data */
SELECT * FROM `wp_options` WHERE `option_value` RLIKE '(a:[0-9]+:{)|(s:[0-9]+:)|(i:[0-9]+;)|(O:[0-9]+:\")';
/* Select rows that don't contain serialized data */
SELECT * FROM `wp_options` WHERE `option_value` NOT RLIKE '(a:[0-9]+:{)|(s:[0-9]+:)|(i:[0-9]+;)|(O:[0-9]+:\")';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment