3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $raw_string = '152124687951<?xml version="1.0"><culo>Amazing</culo></Document>65464614 abc<?xml version="1.0"><culo>Amazing</culo></Document>abc 152124687951<?xml version="1.0"><culo>Amazing</culo></Document>65464614 abc<?xml version="1.0"><culo>Amazing</culo></Document>abc'; $pattern = '@\\<\\?xml.+Document\\>@'; preg_match_all($pattern, $raw_string, $matches, PREG_PATTERN_ORDER); var_dump($matches);
based on iBdnf
Output for 4.3.0 - 7.1.0
array(1) { [0]=> array(3) { [0]=> string(51) "<?xml version="1.0"><culo>Amazing</culo></Document>" [1]=> string(118) "<?xml version="1.0"><culo>Amazing</culo></Document>abc 152124687951<?xml version="1.0"><culo>Amazing</culo></Document>" [2]=> string(51) "<?xml version="1.0"><culo>Amazing</culo></Document>" } }