FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » help to debug a simple php preg_replace
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: help to debug a simple php preg_replace [message #172058 is a reply to message #172057] Fri, 28 January 2011 18:01 Go to previous messageGo to previous message
Luuk is currently offline  Luuk
Messages: 329
Registered: September 2010
Karma:
Senior Member
On 28-01-11 18:43, juliani(dot)moon(at)gmail(dot)com wrote:
> Ooops, the copy-paste was a mess. Now it is again:
>
> <?php
> if (file_exists("infile")) {
> $textline = file_get_contents("infile");
> $hyprtext = preg_replace('/</', '&#60;', $textline);
> $hyprtext = preg_replace('/>/', '&#62;', $textline);
> $hyprtext = preg_replace('/@/', '_at_', $textline);
> $hyprtext = preg_replace("/(http:\/\/[^\s]+)/", "<a href=\"$1\">$1</
> a>", $textline);
> print "$hyprtext";}
> ?>
>
> Note: The line for "http" works fine.

read the docs again... ;)

http://php.net/manual/en/function.preg-replace.php

--
Luuk
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Shri Shraddha Astrology
Next Topic: Asynchronous FTP Upload
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sat Oct 19 15:05:29 GMT 2024

Total time taken to generate the page: 0.04827 seconds