Re: RE: RE: [PHP] Use of preg_replace

2011-07-24 Thread Tim Streater
On 24 Jul 2011 at 19:57, Dajka Tamás 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('/(

Re: RE: RE: [PHP] Use of preg_replace

2011-07-24 Thread Tim Streater
On 24 Jul 2011 at 19:57, Dajka Tamás wrote: > 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

RE: RE: [PHP] Use of preg_replace

2011-07-24 Thread Dajka Tamás
;([>]+From )/','$1', $line) Cheers, Tamas -Original Message- From: Tim Streater [mailto:t...@clothears.org.uk] Sent: Sunday, July 24, 2011 8:51 PM To: Dajka Tamás; PHP General List Subject: Re: RE: [PHP] Use of preg_replace On 24 Jul 2011 at 19:35, Dajka Tamás

Re: RE: [PHP] Use of preg_replace

2011-07-24 Thread Tim Streater
On 24 Jul 2011 at 19:35, Dajka Tamás 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://ww

RE: [PHP] Use of preg_replace

2011-07-24 Thread Dajka Tamás
Hi, I lost trail, what do you want to do? You want to convert >>>From to this: >>From Or what's the goal? Cheers, Tamas -Original Message- From: Tim Streater [mailto:t...@clothears.org.uk] Sent: Sunday, July 24, 2011 8:07 PM To: PHP General List S

[PHP] Use of preg_replace

2011-07-24 Thread Tim Streater
I need to be able to convert a line of the form: >>>From to have either one more or one less > at the front. A web site tells me that the regexps to use are: 1,$s/^>*From />&/ and 1,$s/^>(>*From )/\1/ respectively (there is a single space after "From"). So, if my text string is in $line, I