Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.php > #11148 > unrolled thread
| Started by | Luuk <Luuk@invalid.lan> |
|---|---|
| First post | 2011-01-28 19:01 +0100 |
| Last post | 2011-01-28 19:01 +0100 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.lang.php
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: help to debug a simple php preg_replace Luuk <Luuk@invalid.lan> - 2011-01-28 19:01 +0100
| From | Luuk <Luuk@invalid.lan> |
|---|---|
| Date | 2011-01-28 19:01 +0100 |
| Subject | Re: help to debug a simple php preg_replace |
| Message-ID | <jscb18-fbm.ln1@luuk.invalid.lan> |
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 top | Article view | comp.lang.php
csiph-web