I have PHP 5.3.2 on my Mac, but my ISP has PHP 5.2.9

I'm looking for confirmation of my problem in 5.2.9 so that I can try to get my ISP to upgrade.

I see the problem on my site at the ISP, but not with interactive php use on my Mac.

The problem:

Code: PHP
Apply
preg_replace('/^[^\%]*(\%[^\%]+\%).*/', '$1', $cell)
where $cell contains (there is a single space at beginning and end)
 valign="top" style="text-align:right; width:75px;"><p class="f-lp">%Price%</p>
and you get
%Price%
but if $cell contains (there is a single space at beginning and end)
 valign="top" style="text-align:right; width:75px;"><p class="f-lp">%LineTotal%</p> </td>
then you get
%LineTotal% </td>
(which has a space on the end).

I've tried various fiddles and variants, but can't get rid of the trailing <space></td> in the second case when using my ISP's PHP.

Please forgive the mix of code and non-code in the CODE block.

David