<?xml version="1.0" encoding="UTF-8"?><rss
version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
xmlns:series="http://unfoldingneurons.com/"
> <channel><title>Comments on: Replace Content in PRE Tags with HTML&#160;Entities</title> <atom:link href="http://davidwalsh.name/php-html-entities/feed" rel="self" type="application/rss+xml" /><link>http://davidwalsh.name/php-html-entities</link> <description>Legendary scribbles about JavaScript, HTML5, AJAX, PHP, CSS, and ∞.</description> <lastBuildDate>Thu, 09 Feb 2012 07:54:33 +0000</lastBuildDate> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.3</generator> <item><title>By: Josh</title><link>http://davidwalsh.name/php-html-entities/comment-page-1#comment-16708</link> <dc:creator>Josh</dc:creator> <pubDate>Wed, 31 Mar 2010 02:56:43 +0000</pubDate> <guid
isPermaLink="false">http://davidwalsh.name/?p=4663#comment-16708</guid> <description>I&#039;ve been using elliotswan.com/postable. It seems to get the job done for me. But it&#039;s nice to know this option.</description> <content:encoded><![CDATA[<p>I&#8217;ve been using elliotswan.com/postable. It seems to get the job done for me. But it&#8217;s nice to know this option.</p> ]]></content:encoded> </item> <item><title>By: Derrick Nelson</title><link>http://davidwalsh.name/php-html-entities/comment-page-1#comment-15702</link> <dc:creator>Derrick Nelson</dc:creator> <pubDate>Thu, 28 Jan 2010 19:34:45 +0000</pubDate> <guid
isPermaLink="false">http://davidwalsh.name/?p=4663#comment-15702</guid> <description>To solve the nested &#039;pre&#039; tag issue, just use some non-standard tags that you&#039;re sure won&#039;t be in your content, rather than &#039;pre&#039; (i.e. &#039;mycode&#039;).  Your regular expression then becomes a match for the &#039;mycode&#039; tags, and you can immediately follow it up with another preg_replace () to turn the &#039;mycode&#039; tags into &#039;pre&#039; tags after you&#039;re done htmlentitizing the content.</description> <content:encoded><![CDATA[<p>To solve the nested &#8216;pre&#8217; tag issue, just use some non-standard tags that you&#8217;re sure won&#8217;t be in your content, rather than &#8216;pre&#8217; (i.e. &#8216;mycode&#8217;).  Your regular expression then becomes a match for the &#8216;mycode&#8217; tags, and you can immediately follow it up with another preg_replace () to turn the &#8216;mycode&#8217; tags into &#8216;pre&#8217; tags after you&#8217;re done htmlentitizing the content.</p> ]]></content:encoded> </item> <item><title>By: Kendall</title><link>http://davidwalsh.name/php-html-entities/comment-page-1#comment-15700</link> <dc:creator>Kendall</dc:creator> <pubDate>Thu, 28 Jan 2010 17:13:32 +0000</pubDate> <guid
isPermaLink="false">http://davidwalsh.name/?p=4663#comment-15700</guid> <description>One issue to watch out for is to not encode any of the content before this is run, as it will double-entitize the ampersand e.g., &amp;.Also, would there be any issues if not matches are found?</description> <content:encoded><![CDATA[<p>One issue to watch out for is to not encode any of the content before this is run, as it will double-entitize the ampersand e.g., &amp;amp;.</p><p>Also, would there be any issues if not matches are found?</p> ]]></content:encoded> </item> <item><title>By: Corey Worrell</title><link>http://davidwalsh.name/php-html-entities/comment-page-1#comment-15699</link> <dc:creator>Corey Worrell</dc:creator> <pubDate>Thu, 28 Jan 2010 16:33:10 +0000</pubDate> <guid
isPermaLink="false">http://davidwalsh.name/?p=4663#comment-15699</guid> <description>It works as long as you don&#039;t have nested &lt;pre&gt; tags.
I wrote about this on &lt;a href=&quot;http://coreyworrell.com/blog/article/convert-to-html-entities-between-code-tags&quot; rel=&quot;nofollow&quot;&gt;my blog&lt;/a&gt; but the only real way to do it is to use an XML parser.</description> <content:encoded><![CDATA[<p>It works as long as you don&#8217;t have nested &lt;pre&gt; tags.<br
/> I wrote about this on <a
href="http://coreyworrell.com/blog/article/convert-to-html-entities-between-code-tags" rel="nofollow">my blog</a> but the only real way to do it is to use an XML parser.</p> ]]></content:encoded> </item> <item><title>By: Kevin Chapelier</title><link>http://davidwalsh.name/php-html-entities/comment-page-1#comment-15697</link> <dc:creator>Kevin Chapelier</dc:creator> <pubDate>Thu, 28 Jan 2010 15:56:36 +0000</pubDate> <guid
isPermaLink="false">http://davidwalsh.name/?p=4663#comment-15697</guid> <description>Beware that having a pre tag inside another pre tag would leave you with one pre opening and two pre closings. If this is a possible usecase, you might use a regex like this :/&lt;pre.*?&gt;(.*?[&lt;pre.*?&gt;.*&lt;\/pre&gt;]*)&lt;\/pre&gt;/imsuThe tags got stripped in my first comment, sorry about that, if htmlentities show up in the regex, replace them with the good characters …but it still wouldn’t handle the case of having a single closing pre tag inside another pre. Could someone manage to write a regex which would handle this case ?The function name (pre_entities) should be between quotes otherwise it will throw a notice.</description> <content:encoded><![CDATA[<p>Beware that having a pre tag inside another pre tag would leave you with one pre opening and two pre closings. If this is a possible usecase, you might use a regex like this :</p><p>/&lt;pre.*?&gt;(.*?[&lt;pre.*?&gt;.*&lt;\/pre&gt;]*)&lt;\/pre&gt;/imsu</p><p>The tags got stripped in my first comment, sorry about that, if htmlentities show up in the regex, replace them with the good characters …but it still wouldn’t handle the case of having a single closing pre tag inside another pre. Could someone manage to write a regex which would handle this case ?</p><p>The function name (pre_entities) should be between quotes otherwise it will throw a notice.</p> ]]></content:encoded> </item> <item><title>By: Kevin Chapelier</title><link>http://davidwalsh.name/php-html-entities/comment-page-1#comment-15696</link> <dc:creator>Kevin Chapelier</dc:creator> <pubDate>Thu, 28 Jan 2010 15:48:08 +0000</pubDate> <guid
isPermaLink="false">http://davidwalsh.name/?p=4663#comment-15696</guid> <description>Beware that having someting like &quot;something&quot; in another  would leave you with one  opening and two  closings. If this is a possible usecase, you might use a regex like this :/(.*?[.*]*)/imsu...but it still wouldn&#039;t handle the case of having a single  closing tag inside another . Could someone manage to write a regex which would handle this case ?The function name (pre_entities) should be between quotes otherwise it will throw a notice.</description> <content:encoded><![CDATA[<p>Beware that having someting like &#8220;something&#8221; in another  would leave you with one  opening and two  closings. If this is a possible usecase, you might use a regex like this :</p><p>/(.*?[.*]*)/imsu</p><p>&#8230;but it still wouldn&#8217;t handle the case of having a single  closing tag inside another . Could someone manage to write a regex which would handle this case ?</p><p>The function name (pre_entities) should be between quotes otherwise it will throw a notice.</p> ]]></content:encoded> </item> </channel> </rss>
<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic
Page Caching using disk: enhanced (User agent is rejected)
Database Caching 1/13 queries in 0.010 seconds using disk: basic
Object Caching 605/606 objects using disk: basic

Served from: davidwalsh.name @ 2012-02-09 03:49:41 -->
