Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#4 Delete space at begin of paragraph

v3.0b
open
nobody
None
5
2005-02-28
2005-02-28
Renso Lohuis
No

Te beginning of a paragraph starts ofthen with a
(unwanted) space. This is a space after the <P>, <td>
etc. tag.

I used the following work around to delete this space in
the HTML, before it get parsed. This removes the space
in the beginning of the paragraph.

//Match every tag except "text" tags with white space
$regexp = '#(<\s*(?!(b|strong|i|em|u|span|font)\b)[^/][^>]
*>)(\s+)#si';

//Remove the whitespace
$html = preg_replace($regexp, '\\1', $html);

Any comments, improvements etc. are welcome.

Renso Lohuis

Discussion

  • Brother its not helpful to me,
    Please code it accordingly. :-/