----- Original Message -----
From: "Phill Sparks"
On 03/10/2007, listgroups wrote
>
> To get to a standard (\n) from all formats -
> $mystring = str_replace("\r", "\n", $my_string);
> to remove all double line feeds -
> while(strpos($my_string, "\n\n") != FALSE)
> {
> $my_srting = str_replace("\n\n", "\n", $my_string);
> }
>
You could also use one line of preg_replace...
$my_string = preg_replace("/\n{2,}/", "\n", $my_string);
-----------------------------
Hi Phill,
My understanding is that the REGEX engine loads into ram and
consumes resources as both RAM and CPU cycles.
Normally I would use REGEX if I am loading it anyway to use for something
like validating user input but otherwise I avoid loading it for simple
tasks.
Is this right? or have I been misled ?
Thanks, Rob.