I need to transform this
329638.798,7387605.001,330131.098,7387324.001,329740.398,7386851.001
^ ^
Into this
329638.798,7387605.001L330131.098,7387324.001L329740.398,7386851.001
^ ^
More simply
a1,b1,a2,b2,a3,b3 => a1,b1La2,b2La3,b3
This means replace every second occurence of comma with an 'L'.
I've read this post and tried this
preg_replace('/(\S+,\S+)\s,/', '$1L', $geom);
without success.