Well, this is necessary if the replacement potentially creates new matches in the next iteration. This is not very wasteful, because it is only an additional check in the worst case.
Walking around the code that it matches, it seems unlikely that it will create new matches by replacement, however: it is very strict that it matches.
: , , , , , , , . , . (, ), , , .
, . <<iframe>iframe>, . -, (, < iframe> ).
EDIT2: , ( ). , *+ ( , , , - ?).