Files
doc-fr/reference/regex/examples.xml
Yannick Torres 15008f6334 sync with EN
git-svn-id: https://svn.php.net/repository/phpdoc/fr/trunk@256350 c90b9560-bf6c-de11-be94-00142212c4b1
2008-03-30 13:57:46 +00:00

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
-->