php - How to remove whitespace between a <td> tag until the string? -
i have string
<td> text</td><td> july 3, 2013</td>
i want remove leading spaces resulting string looks like
<td>some text</td><td>july 3, 2013</td>
i playing around preg_replace, can't seem figure out proper syntax.
preg_replace('/<td>\s+/', '<td>', $strip2); **<-doesn't work**
your regexp works perfectly:
<?php $str = "<td> 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>
Comments
Post a Comment