I have a string
<td> Some text</td><td> July 3, 2013</td>
I want to remove the leading spaces so the resulting string looks like
<td>Some text</td><td>July 3, 2013</td>
I am playing around with preg_replace, but can't seem to figure out the proper syntax.
preg_replace('/<td>\s+/', '<td>', $strip2); **<-doesn't work**
Your regexp works perfectly:
<?php
$str = "<td> Some text</td><td> July 3, 2013</td>";
$str = preg_replace('/<td>\s+/', '<td>', $str);
print $str;
prints:
<td>Some text</td><td>July 3, 2013</td>
Finally found the piece of code i needed to clean up my string
preg_replace('/[^(\x20-\x7F)]*/', '', $strip2);