3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php //if -behind- have double or more (\\) match it, but if (\) its one ignore it //get -behind\\- $str = 'hey look -behind\\- you'; //ignore -behind\- $str = 'hey look -behind\- you'; preg_match_all('/\-(.*?)(?<!\\\{2})\-/', $str, $matched); var_dump($matched);
based on MnoBl
Output for 5.6.0 - 7.2.6
array(2) { [0]=> array(1) { [0]=> string(9) "-behind\-" } [1]=> array(1) { [0]=> string(7) "behind\" } }