I'm feeling very silly for not being able to figure this one out, but I just cant figure it. I need to replace a regex string with a pattern, I found two examples of doing it, but they honestly left me more confused than ever.
This is my current attempt:
$string = '26 14:46:54",,"2011-08-26 14:47:02",8,0,"BUSY","DOCUMENTATION","1314370014.18","","","61399130249","7466455647","from-internal","""Oh Snap"" <61399130249>","SIP/1037-00000014","SIP/CL-00000015","Dial","SIP/CL/61436523277,45","2011-08-26 14:47:06","2011-08-26 14:47:15","2011-08-26 ';
$pattern = '["SIP/CL/\d*?,\d*?",]';
$replacement = '"SIP/CL/\1|\2",';
$string = preg_replace($pattern, $replacement, $string);
print($string);
But that just replaces the \1 and \2 with blanks. So obviously I'm not getting the entire concept.
What I'm wanting at the end is to change:
this: "SIP/CL/61436523277,45"
to: "SIP/CL/61436523277|45"
That comma in a poorly formatted CSV throws off some of my other scripts.
fgetcsvfor this, are you not? Orstr_getcsvif it is a string.fgetcsvdoesn't read a total file into memory either, just line by line ;)