You want to do it in a greater text, I think. 1,$s/^>(>*From )/\1/ $line = preg_replace ($pattern, $replacement, $line); Adding one '>': preg_replace('/(^[>]+From )/','>$1', $line) Removing one '>': preg_replace('/(^>([>]+From )/','$1', $line) Cheers, Tamas -----Original Message----- From: Tim Streater [mailto:tim@xxxxxxxxxxxxxxxx] Sent: Sunday, July 24, 2011 8:51 PM To: Dajka Tamás; PHP General List Subject: Re: RE: Use of preg_replace On 24 Jul 2011 at 19:35, Dajka Tamás <viper@xxxxxxxxxxx> wrote: > I lost trail, what do you want to do? > > You want to convert > >>>> From > > to this: > >>> From The number of > in front of "From " is not known. I want to be able to add or remove one. -- Cheers -- Tim -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php