3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $pattern = '(foo|bar)/*'; $pattern = preg_quote($pattern, '#'); // Asterisks are translated into zero-or-more regular expression wildcards // to make it convenient to check if the strings starts with the given // pattern such as "library/*", making any string check convenient. $pattern = str_replace('\*', '.*', $pattern).'\z'; echo '#^'.$pattern.'#';
Output for 4.3.0 - 7.1.0
#^\(foo\|bar\)/.*\z#