[PHP-DEV] RE: Bug #485 Updated: ereg_replace and Linefeeds From: Philip Quaife (philip <email protected>)
Date: 06/27/98

I obviously was not clear on what I wanted and what I got.

Even with your example, the resultant string was having the letter n
on its own being replaced by new-line character.

What I was doing was :

 1. replace the new-line with the two character sequence backslash+n

 2. after retrieval mysql would auto convert (erroneously) the \n to
    new-line.

 3. Because the MSSQL driver does not have this fault, I found (I
    believe) the error in reg_replace.

So the error is that:

Given a string that contains one backslash + one "n" character the
command:
             ereg_replace("\\n","\n")
should convert the two characters to a one character sequence
(new-line).

The Error is:

    That the backslash remains unconverted and that all letter "n" are
replaced by the resultant string (new-line).

        ie. interpereted as: ereg_replace("n","\n")

I am not an expert on reqular expressions, but I believe that the
expression should be evaluated left to right so that the term \\n
should read as the two character sequence backslash+"n"

Thank you for your time, if this is not an errant behaviour then
sorry for the inconvenience.

----
Philip Quaife
Q Solutions
philip <email protected>
28-Jun-98    13:59:07