On 24 Jul 2011 at 19:57, Dajka Tamás <vi...@vipernet.hu> wrote: 

> You want to do it in a greater text, I think.

See below.

> 1,$s/^>(>*From )/\1/
>
> $line = preg_replace ($pattern, $replacement, $line);
>
> Adding one '>':
>
> preg_replace('/(^[>]+From )/','>$1', $line)
>
> Removing one '>':
>
> preg_replace('/(^>([>]+From )/','$1', $line)
                             ^
                             |
Missing ) -------------------+

In fact I forgot to mention that the string always starts at the start of the 
line. So, I experimented a bit and the following works:


$onemore = preg_replace ('/^(>*From )/', '>$1', $line);
$oneless = preg_replace ('/^>(>*From )/', '$1', $line);

Thanks for the help.

--
Cheers  --  Tim

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to