I have lot of variables created in a module. Is there any wildcard when deleting variables using variable_del.

Ex1: variable_del($key . '_campaign_text_*');
Ex2: variable_del($key . '_campaign_text_%');

Will any of these workout?

  • 1
    No they won't. Wild cards don't work. You'd need to first query the DB and then loop through your results deleting them.
    – Jaypan
    Commented Sep 27, 2016 at 9:14

1 Answer 1


You can try db_delete but handle with caution.

Example :

->condition('name', '_campaign_text_%','LIKE')
cache_clear_all('variables', 'cache_bootstrap');

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.