mirror of
https://github.com/macintoshplus/doc-fr.git
synced 2026-03-29 12:22:19 +02:00
git-svn-id: https://svn.php.net/repository/phpdoc/fr/trunk@256350 c90b9560-bf6c-de11-be94-00142212c4b1
70 lines
1.7 KiB
XML
70 lines
1.7 KiB
XML
<?xml version="1.0" encoding="iso-8859-1"?>
|
|
<!-- $Revision: 1.1 $ -->
|
|
<!-- EN-Revision: 1.2 Maintainer: yannick Status: ready -->
|
|
<!-- Reviewed: yes -->
|
|
|
|
<appendix xml:id="regex.examples">
|
|
&reftitle.examples;
|
|
<para>
|
|
<example>
|
|
<title>Exemples d'expressions rationnelles</title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
/* Retourne true si "abc"
|
|
est trouvé quelque part dans la chaîne $string. */
|
|
ereg("abc", $string);
|
|
|
|
/* Retourne true si "abc"
|
|
est trouvé au début de la chaîne $string. */
|
|
ereg("^abc", $string);
|
|
|
|
/* Retourne true si "abc"
|
|
est trouvé à la fin de la chaîne $string. */
|
|
ereg("abc$", $string);
|
|
|
|
/* Retourne true si le client
|
|
est Netscape 2, 3 ou MSIE 3. */
|
|
eregi("(ozilla.[23]|MSIE.3)", $_SERVER["HTTP_USER_AGENT"]);
|
|
|
|
/* Recherche trois mots séparés par des espaces
|
|
dans les chaînes $regs[1], $regs[2] et $regs[3]. */
|
|
ereg("([[:alnum:]]+) ([[:alnum:]]+) ([[:alnum:]]+)", $string, $regs);
|
|
|
|
/* Insère une balise <br /> au début de la chaîne $string. */
|
|
$string = ereg_replace("^", "<br />", $string);
|
|
|
|
/* Insère une balise <br /> à la fin de la chaîne $string. */
|
|
$string = ereg_replace("$", "<br />", $string);
|
|
|
|
/* Supprime toutes les nouvelles lignes de $string. */
|
|
$string = ereg_replace("\n", "", $string);
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
</para>
|
|
</appendix>
|
|
|
|
<!-- Keep this comment at the end of the file
|
|
Local variables:
|
|
mode: sgml
|
|
sgml-omittag:t
|
|
sgml-shorttag:t
|
|
sgml-minimize-attributes:nil
|
|
sgml-always-quote-attributes:t
|
|
sgml-indent-step:1
|
|
sgml-indent-data:t
|
|
indent-tabs-mode:nil
|
|
sgml-parent-document:nil
|
|
sgml-default-dtd-file:"../../../manual.ced"
|
|
sgml-exposed-tags:nil
|
|
sgml-local-catalogs:nil
|
|
sgml-local-ecat-files:nil
|
|
End:
|
|
vim600: syn=xml fen fdm=syntax fdl=2 si
|
|
vim: et tw=78 syn=sgml
|
|
vi: ts=1 sw=1
|
|
-->
|
|
|