Using PHP 5.3.1 on windows.
I am just trying to add spaces between numbers and letters, but PHP is mangling my data!
$text = "TUES:8:30AM-5:00PMTHURS:8:30AM-5:00PMSAT:8:00AM-1:00PM";
echo preg_replace("/([0-9]+)([A-Z]+)/","\1 \2",$text);
> TUES:8:☺ ☻AM-5:☺ ☻PMTHURS:8:☺ ☻AM-5:☺ ☻PMSAT:8:☺ ☻AM-1:☺ ☻PM
My file type ANSI, no there is no unicode in the source.
What the fun is going on here?
try using
$are your backreference indicator, not ‘\’:I’m betting
\1is getting translated to something funky… notice the strange characters don’t change between the minutes input being ’30’ and ’00’the php manual says you should double-escape your backreference, or use
$(if you are using a version 4.04 or newer)