Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.php > #11148
| Date | 2011-01-28 19:01 +0100 |
|---|---|
| From | Luuk <Luuk@invalid.lan> |
| Newsgroups | comp.lang.php |
| Subject | Re: help to debug a simple php preg_replace |
| References | <2c7b60f6-4912-46bf-8a85-71068de9e4f8@d17g2000vbn.googlegroups.com> <cbd93070-8f10-4376-8ff4-aa1810beef62@g1g2000prb.googlegroups.com> |
| Message-ID | <jscb18-fbm.ln1@luuk.invalid.lan> (permalink) |
On 28-01-11 18:43, juliani.moon@gmail.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('/</', '<', $textline);
> $hyprtext = preg_replace('/>/', '>', $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
Back to comp.lang.php | Previous | Next | Find similar | Unroll thread
Re: help to debug a simple php preg_replace Luuk <Luuk@invalid.lan> - 2011-01-28 19:01 +0100
csiph-web