cvs: phpdoc-fr /reference/regex reference.xml /reference/regex/functions ereg-replace.xml ereg.xml eregi-replace.xml eregi.xml split.xml spliti.xml
sql-regcase.xml

From: Date: Sat, 26 Apr 2003 19:25:12 +0000
Subject: cvs: phpdoc-fr /reference/regex reference.xml /reference/regex/functions ereg-replace.xml ereg.xml eregi-replace.xml eregi.xml split.xml spliti.xml
sql-regcase.xml
Groups: php.doc.fr 
Request: Send a blank email to doc-fr+get-302@lists.php.net to get a copy of this message
dams Sat Apr 26 15:25:12 2003 EDT Modified files: /phpdoc-fr/reference/regex reference.xml /phpdoc-fr/reference/regex/functions ereg-replace.xml ereg.xml eregi-replace.xml eregi.xml split.xml spliti.xml sql-regcase.xml Log: Spring cleaning

Index: phpdoc-fr/reference/regex/reference.xml diff -u phpdoc-fr/reference/regex/reference.xml:1.3 phpdoc-fr/reference/regex/reference.xml:1.4 --- phpdoc-fr/reference/regex/reference.xml:1.3 Tue Aug 13 22:19:34 2002 +++ phpdoc-fr/reference/regex/reference.xml Sat Apr 26 15:25:11 2003 @@ -2,7 +2,25 @@ <reference id="ref.regex"> <title>Expressions r&eacute;guli&egrave;res</title> <titleabbrev>Regex</titleabbrev> - <partintro> + <partintro> + <section id="regex.intro"> + &reftitle.intro; + <note> + <para> + PHP supporte aussi des expressions rationnelles compatibles Perl, avec + l'extension <link linkend="ref.pcre">PCRE functions</link>. Ces fonctions + supportent des recherches non-gourmandes, des assertions, des sous-masques + conditionnels et toute une gamme de fonctionnalit&eacute;s absentes des + expressions rationnelles POSIX. + </para> + </note> + <warning> + <para> + Ces expressiosn rationnelles ne sont pas compatibles avec les + donn&eacute;es binaires. Les <link linkend="ref.pcre">expressions PCRE</link> + le sont. + </para> + </warning> <para> Les expressions r&eacute;guli&egrave;res sont utilis&eacute;es pour effectuer des manipulations complexes de cha&icirc;nes de @@ -31,41 +49,88 @@ comme premier argument. PHP utilise les expressions r&eacute;guli&egrave;res avanc&eacute;es de POSIX (POSIX 1003.2). Pour avoir tous les d&eacute;tails sur ces expressions, reportez vous aux pages de manuel inclues dans le - r&eacute;pertoire de la distribution PHP. - <!-- Should add discussion of PCRE functions here. --> - </para> - <para> - <example> + r&eacute;pertoire de la distribution PHP. Elles sont au format manpage : + pour les lire, vous devrez utiliser la ligne de commande + <command>man /usr/local/src/regex/regex.7</command>. + </para> + </section> + + <section id="regex.requirements"> + &reftitle.required; + &no.requirement; + </section> + + &reference.regex.configure; + + <section id="regex.configuration"> + &reftitle.runtime; + &no.config; + </section> + + <section id="regex.resources"> + &reftitle.resources; + &no.resource; + </section> + + <section id="regex.constants"> + &reftitle.constants; + &no.constants; + </section> + + <section id="regex.examples"> + &reftitle.examples; + <para> + <example> <title>Expressions r&eacute;guli&egrave;res</title> - <programlisting role="php"> -&lt;?php -ereg(&quot;abc&quot;,$string); -/* Retourne &true; si &quot;abc&quot; + <programlisting role="php"> +<![CDATA[ +<?php +ereg ("abc", $string); +/* Retourne &true; si "abc" est trouv&eacute; quelque part dans la cha&icirc;ne $string. */ -ereg(&quot;^abc&quot;,$string); -/* Retourne &true; si &quot;abc&quot; + +ereg ("^abc", $string); +/* Retourne &true; si "abc" est trouv&eacute; au d&eacute;but de la cha&icirc;ne $string. */ -ereg("abc$",$string); -/* Retourne &true; si &quot;abc&quot; + +ereg ("abc$", $string); +/* Retourne &true; si "abc" est trouv&eacute; &agrave; la fin de la cha&icirc;ne $string. */ -eregi("(ozilla.[23]|MSIE.3)",$HTTP_USER_AGENT); + +eregi ("(ozilla.[23]|MSIE.3)", $HTTP_USER_AGENT); /* Retourne &true; si le client est Netscape 2, 3 ou MSIE 3. */ -ereg("([[:alnum:]]+) ([[:alnum:]]+) ([[:alnum:]]+)", - $string,$regs); -/* Introduit trois mots s&eacute;par&eacute;s par des espaces + +ereg ("([[:alnum:]]+) ([[:alnum:]]+) ([[:alnum:]]+)", $string,$regs); +/* Recherche trois mots s&eacute;par&eacute;s par des espaces dans les cha&icirc;nes $regs[1], $regs[2] et $regs[3]. */ -$string = ereg_replace("^","&lt;BR&gt;",$string); -/* Ins&egrave;re une balise &lt;BR&gt; au d&eacute;but de la cha&icirc;ne $string. */ -$string = ereg_replace("$","&lt;BR&gt;",$string); -/* Ins&egrave;re une balise &lt;BR&gt; &agrave; la fin de la cha&icirc;ne $string. */ -$string = ereg_replace("\n","",$string); + +$string = ereg_replace ("^", "<br />", $string); +/* Ins&egrave;re une balise <br /> au d&eacute;but de la cha&icirc;ne $string. */ + +$string = ereg_replace ("$", "<br />", $string); +/* Ins&egrave;re une balise <br /> &agrave; la fin de la cha&icirc;ne $string. */ + +$string = ereg_replace ("\n", "", $string); /* Supprime toutes les nouvelles lignes de $string. */ -?&gt; - </programlisting> - </example> - </para> - </partintro> +?> +]]> + </programlisting> + </example> + </para> + </section> + + <section id="regex.seealso"> + &reftitle.seealso; + <para> + Pour des expressions rationnelles compatibles Perl, voyez l'extension + <link linkend="ref.pcre">PCRE</link>. Les commandes de recherches plus + simples (avec support des caract&egrave;res jokers) sont fournis par la fonction + <function>fnmatch</function>. + </para> + </section> + </partintro> + &reference.regex.functions; Index: phpdoc-fr/reference/regex/functions/ereg-replace.xml diff -u phpdoc-fr/reference/regex/functions/ereg-replace.xml:1.1 phpdoc-fr/reference/regex/functions/ereg-replace.xml:1.2 --- phpdoc-fr/reference/regex/functions/ereg-replace.xml:1.1 Sun Apr 14 20:37:46 2002 +++ phpdoc-fr/reference/regex/functions/ereg-replace.xml Sat Apr 26 15:25:12 2003 @@ -4,7 +4,7 @@ <refentry id="function.ereg-replace"> <refnamediv> <refname>ereg_replace</refname> - <refpurpose>Remplacement par expression r&eacute;guli&egrave;re.</refpurpose> + <refpurpose>Remplacement par expression r&eacute;guli&egrave;re</refpurpose> </refnamediv> <refsect1> <title>Description</title> @@ -42,17 +42,43 @@ Si aucune occurrence n'est trouv&eacute;e, la cha&icirc;ne <parameter>string</parameter> sera retourn&eacute;e intacte. </para> + <para> + Par exemple, le code suivante affiche "Ceci est un test" + trois fois : + <example> + <title>Exemple avec <function>ereg_replace</function></title> + <programlisting> +<![CDATA[ +<?php + $string = "Ceci est un test"; + echo ereg_replace (" fut", " est", $string); + echo ereg_replace ("( )fut", "\\1est", $string); + echo ereg_replace ("(( )fut)", "\\2est", $string); +?> +]]> + </programlisting> + </example> + </para> <para> Par exemple, le code suivant affiche "Ceci etait un test" trois fois : <example> <title>Exemple avec <function>ereg_replace</function></title> <programlisting role="php"> -&lt;?php -$string = "Ceci est un test"; -echo ereg_replace( " est", " etait", $string ); -echo ereg_replace( "( )est ", "\\1etait", $string ); -echo ereg_replace( "(( )est)", "\\2etait", $string ); -?&gt; +<![CDATA[ +<?php +/* Ceci ne fonctionne pas comme attendu */ +$num = 4; +$string = "Cette cha&icirc;ne a quatre mots."; +$string = ereg_replace('four', $num, $string); +echo $string; /* Affiche : 'Cette cha&icirc;ne a mots.' */ + +/* This will work. */ +$num = '4'; +$string = "Cette cha&icirc;ne a quatre mots."; +$string = ereg_replace('four', $num, $string); +echo $string; /* Affiche : 'Cette cha&icirc;ne a 4 mots.' */ +?> +]]> </programlisting> </example> </para> @@ -65,24 +91,31 @@ <example> <title>Exemple avec <function>ereg_replace</function></title> <programlisting role="php"> -&lt;?php +<![CDATA[ +<?php /* Cet exemple ne fonctionne pas comme voulu. */ -$num = 4; -$string = "Cette cha&icirc;ne a quatre mots."; -$string = ereg_replace('quatre', $num, $string); -echo $string; /* Affichage : 'Cette cha&icirc;ne a mots.' */ + $num = 4; + $string = "Cette cha&icirc;ne a quatre mots."; + $string = ereg_replace('quatre', $num, $string); + echo $string; /* Affichage : 'Cette cha&icirc;ne a mots.' */ + /* Ceci est bon. */ -$num = '4'; -$string = "Cette cha&icirc;ne a quatre mots."; -$string = ereg_replace('quatre', $num, $string); -echo $string; /* Affichage : 'Cette cha&icirc;ne a 4 mots.' */ -?&gt; + $num = '4'; + $string = "Cette cha&icirc;ne a quatre mots."; + $string = ereg_replace('quatre', $num, $string); + echo $string; /* Affichage : 'Cette cha&icirc;ne a 4 mots.' */ +?> +]]> </programlisting> </example> </para> <para> - Voir aussi <function>ereg</function>, <function>eregi</function> - et <function>eregi_replace</function>. + Voir aussi + <function>ereg</function>, + <function>eregi</function>, + <function>eregi_replace</function>, + <function>str_replace</function> et + <function>preg_match</function>. </para> </refsect1> </refentry> Index: phpdoc-fr/reference/regex/functions/ereg.xml diff -u phpdoc-fr/reference/regex/functions/ereg.xml:1.2 phpdoc-fr/reference/regex/functions/ereg.xml:1.3 --- phpdoc-fr/reference/regex/functions/ereg.xml:1.2 Thu Feb 20 04:57:54 2003 +++ phpdoc-fr/reference/regex/functions/ereg.xml Sat Apr 26 15:25:12 2003 @@ -4,7 +4,7 @@ <refentry id="function.ereg"> <refnamediv> <refname>ereg</refname> - <refpurpose>Expression r&eacute;guli&egrave;re standard.</refpurpose> + <refpurpose>Expression r&eacute;guli&egrave;re standard</refpurpose> </refnamediv> <refsect1> <title>Description</title> @@ -53,21 +53,27 @@ L'exemple suivant prend une date au format ISO (YYYY-MM-DD) et l'affiche sous la forme DD.MM.YYYY : <example> - <title>Exemple <function>ereg</function></title> + <title>Exemple avec <function>ereg</function></title> <programlisting role="php"> -&lt;?php -if ( ereg( "([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})", $date, $regs ) ) { +<![CDATA[ +<?php + if (ereg ("([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})", $date, $regs)) { echo "$regs[3].$regs[2].$regs[1]"; -} else { - echo "Format de date invalide : $date"; -} -?&gt; + } else { + echo "Format de date invalide : $date"; + } +?> +]]> </programlisting> </example> </para> <para> - Voir aussi <function>eregi</function>, <function>ereg_replace</function>, - <function>eregi_replace</function>, <function>strpos</function> et + Voir aussi + <function>eregi</function>, + <function>preg_match</function>, + <function>ereg_replace</function>, + <function>eregi_replace</function>, + <function>strpos</function> et <function>strstr</function>. </para> </refsect1> Index: phpdoc-fr/reference/regex/functions/eregi-replace.xml diff -u phpdoc-fr/reference/regex/functions/eregi-replace.xml:1.1 phpdoc-fr/reference/regex/functions/eregi-replace.xml:1.2 --- phpdoc-fr/reference/regex/functions/eregi-replace.xml:1.1 Sun Apr 14 20:37:46 2002 +++ phpdoc-fr/reference/regex/functions/eregi-replace.xml Sat Apr 26 15:25:12 2003 @@ -11,20 +11,22 @@ </refnamediv> <refsect1> <title>Description</title> - <methodsynopsis> - <type>string</type><methodname>eregi_replace</methodname> - <methodparam><type>string</type><parameter>pattern</parameter></methodparam> - <methodparam><type>string</type><parameter>replacement</parameter></methodparam> - <methodparam><type>string</type><parameter>string</parameter></methodparam> - </methodsynopsis> + <methodsynopsis> + <type>string</type><methodname>eregi_replace</methodname> + <methodparam><type>string</type><parameter>pattern</parameter></methodparam> + <methodparam><type>string</type><parameter>replacement</parameter></methodparam> + <methodparam><type>string</type><parameter>string</parameter></methodparam> + </methodsynopsis> <para> <function>eregi_replace</function> est identique &agrave; <function>ereg_replace</function>, hormis le fait qu'elle ne tient pas compte de la casse des caract&egrave;res alphab&eacute;tiques. </para> <para> - Voir aussi <function>ereg</function>, <function>eregi</function> - et <function>ereg_replace</function>. + Voir aussi + <function>ereg</function>, + <function>eregi</function> et + <function>ereg_replace</function>. </para> </refsect1> </refentry> Index: phpdoc-fr/reference/regex/functions/eregi.xml diff -u phpdoc-fr/reference/regex/functions/eregi.xml:1.2 phpdoc-fr/reference/regex/functions/eregi.xml:1.3 --- phpdoc-fr/reference/regex/functions/eregi.xml:1.2 Thu Feb 20 04:57:54 2003 +++ phpdoc-fr/reference/regex/functions/eregi.xml Sat Apr 26 15:25:12 2003 @@ -5,7 +5,7 @@ <refnamediv> <refname>eregi</refname> <refpurpose> - Recherche par expression r&eacute;guli&egrave;re insensible &agrave; la casse. + Recherche par expression r&eacute;guli&egrave;re insensible &agrave; la casse </refpurpose> </refnamediv> <refsect1> @@ -20,11 +20,26 @@ <function>eregi</function> est identique &agrave; <function>ereg</function>, hormis le fait qu'elle ignore la casse des caract&egrave;re lors de la recherche sur les caract&egrave;re alphab&eacute;tiques. + <example> + <title>Exemple avec <function>eregi</function></title> + <programlisting role="php"> +<![CDATA[ +<?php + if (eregi("z", $string)) { + echo "'$string' contient un 'z' ou un 'Z'!"; + } +?> +]]> + </programlisting> + </example> </para> <para> - Voir aussi <function>ereg</function>, <function>ereg_replace</function>, - <function>eregi_replace</function>, <function>strpos</function> et - <function>strstr</function>. + Voir aussi + <function>ereg</function>, + <function>ereg_replace</function>, + <function>eregi_replace</function>, + <function>stripos</function> et + <function>stristr</function>. </para> </refsect1> </refentry> Index: phpdoc-fr/reference/regex/functions/split.xml diff -u phpdoc-fr/reference/regex/functions/split.xml:1.2 phpdoc-fr/reference/regex/functions/split.xml:1.3 --- phpdoc-fr/reference/regex/functions/split.xml:1.2 Thu Feb 13 14:17:48 2003 +++ phpdoc-fr/reference/regex/functions/split.xml Sat Apr 26 15:25:12 2003 @@ -19,7 +19,7 @@ <methodparam choice="opt"><type>int</type><parameter>limit</parameter></methodparam> </methodsynopsis> <para> - <function>split</function> retourne une tableau de cha&icirc;nes : + <function>split</function> retourne un tableau de cha&icirc;nes : chacune d'entre elle est une sous-cha&icirc;ne de <parameter>string</parameter> d&eacute;limit&eacute;e par les occurrences trouv&eacute;es de l'expression r&eacute;guli&egrave;re @@ -32,9 +32,11 @@ <example> <title>Exemple avec <function>split</function></title> <programlisting role="php"> -&lt;?php -$passwd_list = split( ":", $passwd_line, 5 ); -?&gt; +<![CDATA[ +<?php +list($user,$pass,$uid,$gid,$extra)= split (":", $passwd_line, 5); +?> +]]> </programlisting> </example> </para> @@ -44,12 +46,13 @@ <example> <title>Exemple avec <function>split</function></title> <programlisting role="php"> -&lt;?php -$date = "04/30/1973"; -// Les d&eacute;limiteurs peuvent &ecirc;tre des /, des points ou des tirets -list( $month, $day, $year ) = split( '[/.-]', $date ); -echo "Mois: $month; Jour: $day; Annee: $year&lt;br&gt;\n"; -?&gt; +<![CDATA[ +<?php +$date = "04/30/1973"; // Les d&eacute;limiteurs peuvent &ecirc;tre des tirets, points ou slash +list ($month, $day, $year) = split ('[/.-]', $date); +echo "Month: $month; Day: $day; Year: $year<br>\n"; +?> +]]> </programlisting> </example> </para> @@ -63,6 +66,11 @@ moteur d'expressions r&eacute;guli&egrave;res. </para> <para> + Pour les utilisateurs qui recherchent le moyen d'&eacute;muler + la commande Perl <command>@chars = split('', $str)</command>, + voyez <function>preg_split</function>. + </para> + <para> Notez aussi que <parameter>pattern</parameter> est une expression r&eacute;guli&egrave;re. Si vous voulez utiliser n'importe quel caract&egrave;re sp&eacute;cial des expressions @@ -75,7 +83,13 @@ <command>man /usr/local/src/regex/regex.7</command>. </para> <para> - Voir aussi : <function>explode</function> et <function>implode</function>. + Voir aussi + <function>preg_split</function>, + <function>spliti</function>, + <function>explode</function>, + <function>implode</function>, + <function>chunk_split</function> et + <function>wordwrap</function>. </para> </refsect1> </refentry> Index: phpdoc-fr/reference/regex/functions/spliti.xml diff -u phpdoc-fr/reference/regex/functions/spliti.xml:1.1 phpdoc-fr/reference/regex/functions/spliti.xml:1.2 --- phpdoc-fr/reference/regex/functions/spliti.xml:1.1 Sun Apr 14 20:37:47 2002 +++ phpdoc-fr/reference/regex/functions/spliti.xml Sat Apr 26 15:25:12 2003 @@ -6,7 +6,7 @@ <refname>spliti</refname> <refpurpose> Scinde une cha&icirc;ne en un tableau, gr&acirc;ce &agrave; une - expression r&eacute;guli&egrave;re. + expression r&eacute;guli&egrave;re </refpurpose> </refnamediv> <refsect1> @@ -22,7 +22,9 @@ hormis le fait qu'elle ignore la casse. </para> <para> - Voir aussi <function>split</function>, + Voir aussi + <function>preg_spliti</function>, + <function>split</function>, <function>explode</function> et <function>implode</function>. </para> Index: phpdoc-fr/reference/regex/functions/sql-regcase.xml diff -u phpdoc-fr/reference/regex/functions/sql-regcase.xml:1.1 phpdoc-fr/reference/regex/functions/sql-regcase.xml:1.2 --- phpdoc-fr/reference/regex/functions/sql-regcase.xml:1.1 Sun Apr 14 20:37:47 2002 +++ phpdoc-fr/reference/regex/functions/sql-regcase.xml Sat Apr 26 15:25:12 2003 @@ -29,9 +29,11 @@ <example> <title>Exemple avec <function>sql_regcase</function></title> <programlisting role="php"> -&lt;?php -echo sql_regcase( "Foo bar" ); -?&gt; +<![CDATA[ +<?php + echo sql_regcase ("Foo bar"); +?> +]]> </programlisting> </example> affichera <computeroutput>[Ff][Oo][Oo] [Bb][Aa][Rr]</computeroutput>.
« previous php.doc.fr (#302) next »