One of the many, many great features of the PhpStorm editor is a regex find and replace that will highlight what it's going to do as you type the regex. It shows all the matches it finds and what they will be replaced by. Once you get it right, you just paste the pattern into your preg_match statement. It's really a comfort to see that you're not going to trash stuff you don't want altered and it beats the heck out of trial and error.
I would do it with two separate preg_replaces, one for classes and one for IDs.
[[+content:attrizap=`idName,className`]]
Something like this (assuming that they're all divs):
<?
$output = '';
$replace = '';
$options = explode(",", $options);
$idName = $options[0];
$className = $options[1];
$pattern1 = "/<div\s*class\s*=\s*.*\".*" . $className . ".*\".*>.*</div>/";
$pattern2 = "/<div\s*id\s*=\s*.*\".*" . $idName . ".*\".*>.*</div>/";
$output = preg_replace($pattern1, $replace, $input);
$output = preg_replace($pattern2, $replace, $output;
return $output;
The pattern could be simpler if you're absolutely sure of the format (e.g., that there will be no spaces around the equals sign and no cases of multiple classes or extra spaces in the class or id definitions).
[update] I should also mention that if this is a displayed page, you could also just hide or empty the divs with JQuery.
[ed. note: BobRay last edited this post 11 years, 2 months ago.]