joxnas Posted November 17, 2007 at 02:47 PM Report Share #148072 Posted November 17, 2007 at 02:47 PM Procurei antes e não consegui resolve risto que até me parece ser uma coisa simples de resolver. tendo por exemplo isto: $nome="sousa martins"; $nome=nl2br($nome); echo $nome; fiz: eregi("sousa"." "."martins",$nome); e não correspondeu fiz eregi("sousa"."<br />"."martins",$nome); e não correspondeu fiz: eregi("sousa"."<br \/>"."martins",$nome); e não correspondeu fiz: eregi("sousa"."\<\b\r\ \/\>"."martins",$nome); e não correspondeu no codigo fonte aparece sousa<br /> martins è esquisito... O que tenho de fazer para corresponder? e é no espaço/paragrafo que tá o erro porque sese eu mudar para $nome="sousa martins"; $nome=nl2br($nome); esta corresponde: eregi("sousa"." "."martins",$nome); Link to comment Share on other sites More sharing options...
kingless Posted November 17, 2007 at 08:33 PM Report Share #148167 Posted November 17, 2007 at 08:33 PM Utiliza preg_match em vez de ereg <?php $nome = "sousa martins"; preg_match( '/sousa martins/s', $nome, $match ); print_r( $nome ); Link to comment Share on other sites More sharing options...
joxnas Posted November 17, 2007 at 10:11 PM Author Report Share #148189 Posted November 17, 2007 at 10:11 PM pois mas era so um exemplo ,eu preciso de meter regexps lá pa dentro.. Link to comment Share on other sites More sharing options...
Sven Posted November 17, 2007 at 10:51 PM Report Share #148203 Posted November 17, 2007 at 10:51 PM o nl2br põe-te o <br> mas não apaga o final de linha ( \r\n ) por isso que não te funciona Writing software is more fun than workingO covil do Barão Link to comment Share on other sites More sharing options...
kingless Posted November 18, 2007 at 12:24 AM Report Share #148237 Posted November 18, 2007 at 12:24 AM Faltava uma expressão regular no meu 1º exemplo... <?php $nome = "sousa martins"; $nome = nl2br( $nome ); preg_match( '/sousa(.*)martins/s', $nome, $match ); print_r( $match ); Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now