3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $pattern='/^(\p{Pd}+\s*2\.2\.|2\.2\.)/mu'; $texts = array( "– 2.2.04 R", "–– 2.2.04.10 C", "–– 2.2.04.1 CO", "–– 2.2.04.2 CO", "–– 2.2.04.3 CO", "–– 2.2.04.4 CO", "–– 2.2.04.5 CO", "–– 2.2.04.6 CO", "–– 2.2.04.7 CO", "–– 2.2.04.8 CO", "–– 2.2.04.9 CO", "foooooooooooo", "barrrrrrrrrr", "-- foobar", "- 1123", ); foreach($texts as $key=>$text) { if(preg_match($pattern, $text)) { $final_texts[] = $text; } } print_r($final_texts);
Output for 4.4.0 - 4.4.9, 5.0.5 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
Array ( [0] => – 2.2.04 R [1] => –– 2.2.04.10 C [2] => –– 2.2.04.1 CO [3] => –– 2.2.04.2 CO [4] => –– 2.2.04.3 CO [5] => –– 2.2.04.4 CO [6] => –– 2.2.04.5 CO [7] => –– 2.2.04.6 CO [8] => –– 2.2.04.7 CO [9] => –– 2.2.04.8 CO [10] => –– 2.2.04.9 CO )
Output for 5.0.4
Warning: preg_match(): Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 3 in /in/2h108 on line 24 Warning: preg_match(): Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 3 in /in/2h108 on line 24 Warning: preg_match(): Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 3 in /in/2h108 on line 24 Warning: preg_match(): Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 3 in /in/2h108 on line 24 Warning: preg_match(): Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 3 in /in/2h108 on line 24 Warning: preg_match(): Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 3 in /in/2h108 on line 24 Warning: preg_match(): Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 3 in /in/2h108 on line 24 Warning: preg_match(): Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 3 in /in/2h108 on line 24 Warning: preg_match(): Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 3 in /in/2h108 on line 24 Warning: preg_match(): Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 3 in /in/2h108 on line 24 Warning: preg_match(): Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 3 in /in/2h108 on line 24 Warning: preg_match(): Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 3 in /in/2h108 on line 24 Warning: preg_match(): Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 3 in /in/2h108 on line 24 Warning: preg_match(): Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 3 in /in/2h108 on line 24 Warning: preg_match(): Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 3 in /in/2h108 on line 24 Notice: Undefined variable: final_texts in /in/2h108 on line 29
Output for 4.3.11, 5.0.0 - 5.0.3
Warning: preg_match(): Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 3 in /in/2h108 on line 24 Warning: preg_match(): Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 3 in /in/2h108 on line 24 Warning: preg_match(): Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 3 in /in/2h108 on line 24 Warning: preg_match(): Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 3 in /in/2h108 on line 24 Warning: preg_match(): Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 3 in /in/2h108 on line 24 Warning: preg_match(): Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 3 in /in/2h108 on line 24 Warning: preg_match(): Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 3 in /in/2h108 on line 24 Warning: preg_match(): Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 3 in /in/2h108 on line 24 Warning: preg_match(): Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 3 in /in/2h108 on line 24 Warning: preg_match(): Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 3 in /in/2h108 on line 24 Warning: preg_match(): Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 3 in /in/2h108 on line 24 Warning: preg_match(): Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 3 in /in/2h108 on line 24 Warning: preg_match(): Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 3 in /in/2h108 on line 24 Warning: preg_match(): Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 3 in /in/2h108 on line 24 Warning: preg_match(): Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 3 in /in/2h108 on line 24 Notice: Undefined variable: final_texts in /in/2h108 on line 29
Output for 4.3.0 - 4.3.10
Warning: Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 3 in /in/2h108 on line 24 Warning: Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 3 in /in/2h108 on line 24 Warning: Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 3 in /in/2h108 on line 24 Warning: Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 3 in /in/2h108 on line 24 Warning: Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 3 in /in/2h108 on line 24 Warning: Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 3 in /in/2h108 on line 24 Warning: Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 3 in /in/2h108 on line 24 Warning: Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 3 in /in/2h108 on line 24 Warning: Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 3 in /in/2h108 on line 24 Warning: Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 3 in /in/2h108 on line 24 Warning: Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 3 in /in/2h108 on line 24 Warning: Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 3 in /in/2h108 on line 24 Warning: Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 3 in /in/2h108 on line 24 Warning: Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 3 in /in/2h108 on line 24 Warning: Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 3 in /in/2h108 on line 24 Notice: Undefined variable: final_texts in /in/2h108 on line 29