3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $regex = '/^\s*<\S+\s*\S*>[\s\S]*?(?:^\s*<\/\S+>)/m'; $vhost = ' DocumentRoot /www/example2 ServerName www.example.org ErrorLog /var/log/log.txt <Directory> ErrorLog /var/log/log.txt </Directory> <Directory /> ErrorLog /var/log/log.txt </Directory>'; preg_match_all($regex, $vhost, $matches); var_dump($matches);
based on pK5Xd
Output for 4.3.0 - 7.1.0
array(1) { [0]=> array(2) { [0]=> string(56) " <Directory> ErrorLog /var/log/log.txt </Directory>" [1]=> string(58) " <Directory /> ErrorLog /var/log/log.txt </Directory>" } }