Skip to content

Commit 0793b48

Browse files
committed
Update pcre
1 parent a97cd72 commit 0793b48

File tree

3 files changed

+18
-3
lines changed

3 files changed

+18
-3
lines changed

reference/pcre/functions/preg-grep.xml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<!-- $Revision$ -->
3-
<!-- EN-Revision: 41c8533ff5a8f93ba9fdf0732d05dd5ab79864c9 Maintainer: daijie Status: ready -->
3+
<!-- EN-Revision: d6f54016d62904cfd8200604aadd5e3f0d9bad97 Maintainer: daijie Status: ready -->
44
<!-- CREDITS: Luffy, mowangjuanzi -->
55
<refentry xml:id="function.preg-grep" xmlns="http://docbook.org/ns/docbook">
66
<refnamediv>
@@ -76,8 +76,12 @@
7676
<programlisting role="php">
7777
<![CDATA[
7878
<?php
79+
$array = [ "4", M_PI, "2.74", 42 ];
80+
7981
// 返回所有包含浮点数的元素
8082
$fl_array = preg_grep("/^(\d+)?\.\d+$/", $array);
83+
84+
var_dump($fl_array);
8185
?>
8286
]]>
8387
</programlisting>

reference/pcre/functions/preg-match.xml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<!-- $Revision$ -->
3-
<!-- EN-Revision: 41c8533ff5a8f93ba9fdf0732d05dd5ab79864c9 Maintainer: daijie Status: ready -->
3+
<!-- EN-Revision: d6f54016d62904cfd8200604aadd5e3f0d9bad97 Maintainer: daijie Status: ready -->
44
<!-- CREDITS: mowangjuanzi -->
55
<refentry xml:id="function.preg-match" xmlns="http://docbook.org/ns/docbook">
66
<refnamediv>
@@ -305,6 +305,8 @@ if (preg_match("/\bweb\b/i", "PHP is the web scripting language of choice.")) {
305305
echo "A match was not found.";
306306
}
307307
308+
echo "\n";
309+
308310
if (preg_match("/\bweb\b/i", "PHP is the website scripting language of choice.")) {
309311
echo "A match was found.";
310312
} else {

reference/pcre/functions/preg-replace.xml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<!-- $Revision$ -->
3-
<!-- EN-Revision: 62126c55f1c6ed444043e7272c4f9e233818a44b Maintainer: daijie Status: ready -->
3+
<!-- EN-Revision: d6f54016d62904cfd8200604aadd5e3f0d9bad97 Maintainer: daijie Status: ready -->
44
<!-- CREDITS: mowangjuanzi, Luffy -->
55
<refentry xml:id="function.preg-replace" xmlns="http://docbook.org/ns/docbook">
66
<refnamediv>
@@ -189,6 +189,15 @@ The bear black slow jumps over the lazy dog.
189189
<programlisting role="php">
190190
<![CDATA[
191191
<?php
192+
$string = 'The quick brown fox jumps over the lazy dog.';
193+
$patterns = array();
194+
$patterns[0] = '/quick/';
195+
$patterns[1] = '/brown/';
196+
$patterns[2] = '/fox/';
197+
$replacements = array();
198+
$replacements[2] = 'bear';
199+
$replacements[1] = 'black';
200+
$replacements[0] = 'slow';
192201
ksort($patterns);
193202
ksort($replacements);
194203
echo preg_replace($patterns, $replacements, $string);

0 commit comments

Comments
 (0)