<?php
$text = <<<TEXT
– 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
TEXT;
$arr = explode("\n", $text);
$pattern = '/^([\p{Pd}]*\s*2\.2\.|2\.2\.)/';
foreach ($arr as $string) {
if (preg_match($pattern, $string)) {
echo $string.' — Match!';
} else {
echo $string.' — Not match!';
}
echo PHP_EOL;
}
– 2.2.04 R — Not match!
–– 2.2.04.10 C — Not match!
–– 2.2.04.1 CO — Not match!
–– 2.2.04.2 CO — Not match!
–– 2.2.04.3 CO — Not match!
–– 2.2.04.4 CO — Not match!
–– 2.2.04.5 CO — Not match!
–– 2.2.04.6 CO — Not match!
–– 2.2.04.7 CO — Not match!
–– 2.2.04.8 CO — Not match!
–– 2.2.04.9 CO — Not match!
– 2.2.04 R — Match!
–– 2.2.04.10 C — Match!
–– 2.2.04.1 CO — Match!
–– 2.2.04.2 CO — Match!
–– 2.2.04.3 CO — Match!
–– 2.2.04.4 CO — Match!
–– 2.2.04.5 CO — Match!
–– 2.2.04.6 CO — Match!
–– 2.2.04.7 CO — Match!
–– 2.2.04.8 CO — Match!
–– 2.2.04.9 CO — Match!
Output for 4.3.11, 5.0.2 - 5.0.4
Warning: preg_match(): Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 4 in /in/ThFQ3 on line 21
– 2.2.04 R — Not match!
Warning: preg_match(): Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 4 in /in/ThFQ3 on line 21
–– 2.2.04.10 C — Not match!
Warning: preg_match(): Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 4 in /in/ThFQ3 on line 21
–– 2.2.04.1 CO — Not match!
Warning: preg_match(): Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 4 in /in/ThFQ3 on line 21
–– 2.2.04.2 CO — Not match!
Warning: preg_match(): Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 4 in /in/ThFQ3 on line 21
–– 2.2.04.3 CO — Not match!
Warning: preg_match(): Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 4 in /in/ThFQ3 on line 21
–– 2.2.04.4 CO — Not match!
Warning: preg_match(): Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 4 in /in/ThFQ3 on line 21
–– 2.2.04.5 CO — Not match!
Warning: preg_match(): Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 4 in /in/ThFQ3 on line 21
–– 2.2.04.6 CO — Not match!
Warning: preg_match(): Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 4 in /in/ThFQ3 on line 21
–– 2.2.04.7 CO — Not match!
Warning: preg_match(): Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 4 in /in/ThFQ3 on line 21
–– 2.2.04.8 CO — Not match!
Warning: preg_match(): Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 4 in /in/ThFQ3 on line 21
–– 2.2.04.9 CO — Not match!
Output for 5.0.0 - 5.0.1
Warning: preg_match(): Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 4 in /in/ThFQ3 on line 21
– 2.2.04 R — Not match!
Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/ThFQ3 on line 26
PHP_EOL
Warning: preg_match(): Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 4 in /in/ThFQ3 on line 21
–– 2.2.04.10 C — Not match!
Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/ThFQ3 on line 26
PHP_EOL
Warning: preg_match(): Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 4 in /in/ThFQ3 on line 21
–– 2.2.04.1 CO — Not match!
Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/ThFQ3 on line 26
PHP_EOL
Warning: preg_match(): Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 4 in /in/ThFQ3 on line 21
–– 2.2.04.2 CO — Not match!
Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/ThFQ3 on line 26
PHP_EOL
Warning: preg_match(): Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 4 in /in/ThFQ3 on line 21
–– 2.2.04.3 CO — Not match!
Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/ThFQ3 on line 26
PHP_EOL
Warning: preg_match(): Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 4 in /in/ThFQ3 on line 21
–– 2.2.04.4 CO — Not match!
Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/ThFQ3 on line 26
PHP_EOL
Warning: preg_match(): Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 4 in /in/ThFQ3 on line 21
–– 2.2.04.5 CO — Not match!
Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/ThFQ3 on line 26
PHP_EOL
Warning: preg_match(): Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 4 in /in/ThFQ3 on line 21
–– 2.2.04.6 CO — Not match!
Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/ThFQ3 on line 26
PHP_EOL
Warning: preg_match(): Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 4 in /in/ThFQ3 on line 21
–– 2.2.04.7 CO — Not match!
Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/ThFQ3 on line 26
PHP_EOL
Warning: preg_match(): Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 4 in /in/ThFQ3 on line 21
–– 2.2.04.8 CO — Not match!
Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/ThFQ3 on line 26
PHP_EOL
Warning: preg_match(): Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 4 in /in/ThFQ3 on line 21
–– 2.2.04.9 CO — Not match!
Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/ThFQ3 on line 26
PHP_EOL
Output for 4.3.10
Warning: Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 4 in /in/ThFQ3 on line 21
– 2.2.04 R — Not match!
Warning: Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 4 in /in/ThFQ3 on line 21
–– 2.2.04.10 C — Not match!
Warning: Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 4 in /in/ThFQ3 on line 21
–– 2.2.04.1 CO — Not match!
Warning: Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 4 in /in/ThFQ3 on line 21
–– 2.2.04.2 CO — Not match!
Warning: Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 4 in /in/ThFQ3 on line 21
–– 2.2.04.3 CO — Not match!
Warning: Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 4 in /in/ThFQ3 on line 21
–– 2.2.04.4 CO — Not match!
Warning: Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 4 in /in/ThFQ3 on line 21
–– 2.2.04.5 CO — Not match!
Warning: Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 4 in /in/ThFQ3 on line 21
–– 2.2.04.6 CO — Not match!
Warning: Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 4 in /in/ThFQ3 on line 21
–– 2.2.04.7 CO — Not match!
Warning: Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 4 in /in/ThFQ3 on line 21
–– 2.2.04.8 CO — Not match!
Warning: Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 4 in /in/ThFQ3 on line 21
–– 2.2.04.9 CO — Not match!
Output for 4.3.0 - 4.3.9
Warning: Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 4 in /in/ThFQ3 on line 21
– 2.2.04 R — Not match!
Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/ThFQ3 on line 26
PHP_EOL
Warning: Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 4 in /in/ThFQ3 on line 21
–– 2.2.04.10 C — Not match!
Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/ThFQ3 on line 26
PHP_EOL
Warning: Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 4 in /in/ThFQ3 on line 21
–– 2.2.04.1 CO — Not match!
Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/ThFQ3 on line 26
PHP_EOL
Warning: Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 4 in /in/ThFQ3 on line 21
–– 2.2.04.2 CO — Not match!
Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/ThFQ3 on line 26
PHP_EOL
Warning: Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 4 in /in/ThFQ3 on line 21
–– 2.2.04.3 CO — Not match!
Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/ThFQ3 on line 26
PHP_EOL
Warning: Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 4 in /in/ThFQ3 on line 21
–– 2.2.04.4 CO — Not match!
Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/ThFQ3 on line 26
PHP_EOL
Warning: Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 4 in /in/ThFQ3 on line 21
–– 2.2.04.5 CO — Not match!
Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/ThFQ3 on line 26
PHP_EOL
Warning: Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 4 in /in/ThFQ3 on line 21
–– 2.2.04.6 CO — Not match!
Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/ThFQ3 on line 26
PHP_EOL
Warning: Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 4 in /in/ThFQ3 on line 21
–– 2.2.04.7 CO — Not match!
Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/ThFQ3 on line 26
PHP_EOL
Warning: Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 4 in /in/ThFQ3 on line 21
–– 2.2.04.8 CO — Not match!
Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/ThFQ3 on line 26
PHP_EOL
Warning: Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 4 in /in/ThFQ3 on line 21
–– 2.2.04.9 CO — Not match!
Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/ThFQ3 on line 26
PHP_EOL