Converting JS RegEx To PHP Not Working

enid

New Member
I had this JS/jQuery:\[code\]$(this).text().replace(/([^\s]+)/, day); \[/code\]which took a line like \[code\]MAR/26/2013 05:00 PM\[/code\] and converted it to \[code\]05:00 PM\[/code\].But this PHP does not do a proper replacement for some reason:\[code\]$time = preg_replace('/([^\s]+)/', '', $dateStr);\[/code\]Instead I am left with a string containing one space.I converted all of my code flawlessly up until the aforementioned line. \[code\]$(this).text()\[/code\] has the same value as \[code\]$dateStr\[/code\].
 
Top