Replace regex with domDocument, update docs