PHP
downloads | documentation | faq | getting help | mailing lists | wiki | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

Funções para Regex POSIX> <Constantes pré-definidas
Last updated: Fri, 21 Nov 2008

view this page in

Exemplos

Exemplo #1 Exemplos de Expressões Regulares

<?php
// Retorna true se "abc" existir em qualquer lugar de $string.
ereg ("abc"$string);

// Retorna true se "abc" existir no início de $string.
ereg ("^abc"$string);

// Retorna true se "abc" existir no final de $string.
ereg ("abc$"$string);

// Retorna true se o navegador do cliente  for Netscape 2, 3 ou MSIE 3.
eregi ("(ozilla.[23]|MSIE.3)"$_SERVER["HTTP_USER_AGENT"]);

// Adiciona três palavras separadas por espaço em $regs[1], $regs[2] e $regs[3].
ereg ("([[:alnum:]]+) ([[:alnum:]]+) ([[:alnum:]]+)"$string,$regs);

// Acrescenta a tag <br /> no início de $string.
$string ereg_replace ("^""<br />"$string);

// Acrescenta a tag <br />; no final de $string.
$string ereg_replace ("$""<br />"$string);

// Remove todos caracteres de nova linha (newline) em $string.
$string ereg_replace ("\n"""$string);
?>



add a note add a note User Contributed Notes
Exemplos
There are no user contributed notes for this page.

Funções para Regex POSIX> <Constantes pré-definidas
Last updated: Fri, 21 Nov 2008
 
 
show source | credits | sitemap | contact | advertising | mirror sites