On Wed, Jan 12, 2011 at 9:30 AM, Jim Yi <j...@jimyi.com> wrote: > This problem is much better suited for an XML parser, and it makes your code > more readable as well. Code snippet: > $dom = new DOMDocument(); > $dom->loadHTML($txt); > $items = $dom->getElementsByTagName('p'); > foreach ($items as $paragraph) { > echo $paragraph->nodeValue; > // You can also manipulate and update the nodeValue within this loop as > well > }
I will have to try this out, because I am not sure that the approach I was taking will work. This however, probably would because it will only apply changes to the P elements in the text. The trouble I ran into was that links were being applied to H1-H6 elements as well, which isn't what I want. -- Randal Rust R.Squared Communications www.r2communications.com www.facebook.com/r2communications 614-370-0036 _______________________________________________ New York PHP Users Group Community Talk Mailing List http://lists.nyphp.org/mailman/listinfo/talk http://www.nyphp.org/Show-Participation