3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php //$regex = "#\b(?:(?:[[:alpha:]]+\://)|www\.)(?:(?:[-[:alnum:]]+\.)*[-[:alnum:]]+(?::\d+)?)(?:/(?:[[:alnum:]\-\._~\!\$&'\(\)\*\+,;\=\:@/]|(?:%[[:xdigit:]]{2}))*)?(?:\?(?:[[:alnum:]\-\._~\!\$&'\(\)\*\+,;\=\:@/\?]|(?:%[[:xdigit:]]{2}))*)?(?:\#(?:[[:alnum:]\-\._~\!\$&'\(\)\*\+,;\=\:@/\?]|(?:%[[:xdigit:]]{2}))*)?#m"; $unicodeRegex = "#\b(?:(?:[[:alpha:]]+\://)|www\.)(?:(?:[-[:alnum:]]+\.)*[-[:alnum:]]+(?::\d+)?)(?:/(?:[[:alnum:]\-\._~\!\$&'\(\)\*\+,;\=\:@/]|(?:%[[:xdigit:]]{2}))*)?(?:\?(?:[[:alnum:]\-\._~\!\$&'\(\)\*\+,;\=\:@/\?]|(?:%[[:xdigit:]]{2}))*)?(?:\#(?:[[:alnum:]\-\._~\!\$&'\(\)\*\+,;\=\:@/\?]|(?:%[[:xdigit:]]{2}))*)?#um"; $source = '取り http://foo.com/somepath によると'; //preg_match_all($regex, $source, $matches, PREG_SET_ORDER | PREG_OFFSET_CAPTURE); //var_dump($matches[0][0][0]); preg_match_all($unicodeRegex, $source, $matches, PREG_SET_ORDER | PREG_OFFSET_CAPTURE); var_dump($matches[0][0][0]); var_dump(PCRE_VERSION);
based on a8GlC
Output for 7.2.0
string(23) "http://foo.com/somepath" string(15) "8.41 2017-07-05"
Output for 5.5.32 - 5.5.35, 5.6.18 - 5.6.28, 7.0.3 - 7.1.10
string(23) "http://foo.com/somepath" string(15) "8.38 2015-11-23"
Output for 5.4.43 - 5.4.45, 5.5.27 - 5.5.31, 5.6.11 - 5.6.17, 7.0.0 - 7.0.2
string(23) "http://foo.com/somepath" string(15) "8.37 2015-04-28"
Output for 5.4.41 - 5.4.42, 5.5.25 - 5.5.26, 5.6.9 - 5.6.10
string(23) "http://foo.com/somepath" string(15) "8.36 2014-09-26"
Output for 5.5.24, 5.6.8
string(23) "http://foo.com/somepath" string(15) "8.34 2013-12-15"
Output for 5.3.24 - 5.3.29, 5.4.14 - 5.4.40
string(23) "http://foo.com/somepath" string(15) "8.32 2012-11-30"
Output for 5.3.19 - 5.3.23, 5.4.9 - 5.4.13
string(23) "http://foo.com/somepath" string(15) "8.31 2012-07-06"
Output for 5.4.0 - 5.4.8
string(23) "http://foo.com/somepath" string(15) "8.12 2011-01-15"