Added check for empty flags in patterns
Added check for empty alternations