I want to drop all tables except few of them. I am using the following command:
mysqldump -uroot -pxxx --add-drop-table --no-data database | grep ^DROP | grep -v "^(cache|webform|redirect)([_a-z0-9]?)+$" | mysql -uroot -pxxx database
The regex seems to be fine according this http://www.regexr.com/3aa8k, as the tables that I want to skip are cache*,webform*,redirect. But problem is that it drops everything.