You are here: Re: preg_replace question « PHP Programming Language « IT news, forums, messages
Re: preg_replace question

Posted by julian_m on 06/07/06 07:49

lorento wrote:
> Try this :
>
> <?php
> $str = "Hello World ///World Hello\n";
> $str .= "Hellloooooo ///allohhhaaaa\n";
>
> echo "<b>Before : </b><br>$str<br><br>";
>
> echo "<b>After:</b><br>";
> echo preg_replace ("/\/\/\/(.*)/", "", $str);
>
> ?>


Great. Just a small detail which I cant't achieve even though both you
and Rik gave me excelent advice:

Your code output is:

After:
Hello World Hellloooooo

whereas I would like to get

Hello World
Hellloooooo

So I thought it would be esay to solve just changing
>>>echo preg_replace ("/\/\/\/(.*)/", "", $str);
to
>>>echo preg_replace ("/\/\/\/(.*)/", "/n", $str);

Note the "/n"
But it actually doesn't work at all.
What's wrong? Why "/n" doesn't do anything?

regards - julian

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация