// i want a changed $ReElements so $str2 is parsed just as $str $ReElements = '/<(\w+)\s*([^\/>]*)\s*(?:\/>|>(.*?)<(\/\s*\1\s*)>)/s'; $str = ''; $str2 = ''; preg_match_all ($ReElements, $str, $matches); preg_match_all ($ReElements, $str2, $matches2); echo "
";
print_r($matches);
print_r($matches2);