Changed domdocument usage with regex, fixed tests