Use of preg_replace

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 ought to be able to do something like:

$line = preg_replace ($pattern, $replacement, $line);

But, since all regexps are to me, like TECO commands, no better than line-noise, how do I make up $pattern and $replacement from the proffered regexps?

Thanks.

--
Cheers  --  Tim

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

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux