Una cosa tipo questa (non l'ho testata):

Codice PHP:
$pattern '#<(if|elseif|else|/if)(\\s+expr="([^"]*)"\\s*)?\\>#si'