Sorry about the backslashing, use Pastie for this, I really will work on this as soon as I get a chance. It’s very frustrating, because the live preview gets it right, and the same function is used in both cases. I suspect it has something to do with magic_quotes_gpc, which is just a little too voodoo in some cases.
Also, ereg_replace is not as Perl-compatible as preg_replace – if something works in BBEdit, and doesn’t in ereg, then try preg. Note that you have to be very Perl-y with your regex string in preg, ereg is looser.
Unless your data fields can contain commas (can’t tell from your example code) then this should just work. Much less mind-bending than trying to grab the indexed properties one at a time inside a regex.
Yeah it looks like you are doing straight replacement rather than
looking for specific patterns, I agree with Walter that tokenizing the
string and then replacing the nth token may be the best option (if
that’s what you are wanting to do).
On 22 May 2008, at 10:47, Paul wrote:
I have a regular expression which works well as GREP in BBEdit, but
I can’t get the thing to work in PHP. When I run this: