<?xml version="1.0" encoding="utf-8" ?><rss version="2.0" xml:base="https://www.webmaster-forums.net/crss/node/1044354" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title></title>
    <link>https://www.webmaster-forums.net/crss/node/1044354</link>
    <description></description>
    <language>en</language>
          <item>
    <title>Is the variable &#039;tagname&#039;</title>
    <link>https://www.webmaster-forums.net/web-programming-and-application-development/extract-content-between-all-certain-html-tags-and-put-ar#comment-1243319</link>
    <description> &lt;p&gt;Is the variable &#039;tagname&#039; defined elsewhere in the code?  I&#039;m guessing that&#039;s the &quot;certain tag&quot; that will be sought to which you were referring?&lt;/p&gt;
&lt;p&gt;Anyway, your expression is confusing me a bit.  I&#039;m certainly no expert (and I know you didn&#039;t write the expression, but why at one point are they searching for a &quot;&amp;gt;&quot; or anything but a &quot;&amp;gt;&quot; (optional) and then a &quot;&amp;gt;&quot;.  Wouldn&#039;t the second search produce the same result?&lt;br /&gt;
&lt;div class=&quot;codeblock&quot;&gt;&lt;code&gt;...(&amp;gt;|[^&amp;gt;]*&amp;gt;)...&lt;/code&gt;&lt;/div&gt;&lt;/p&gt;
&lt;p&gt;Also, maybe I&#039;m not seeing exactly what you want, but I don&#039;t see the reasoning behind all the line feeds, tabs, etc...&lt;/p&gt;
&lt;p&gt;Here&#039;s what I would use, though I haven&#039;t tested it completely:&lt;br /&gt;
&lt;div class=&quot;codeblock&quot;&gt;&lt;code&gt;&amp;quot;/^(.*)(&amp;lt;$tagname([^&amp;gt;]*&amp;gt;))(.*)(&amp;lt;\/$tagname&amp;gt;))(.*)$/&amp;quot;&lt;/code&gt;&lt;/div&gt;&lt;/p&gt;
&lt;p&gt;Edit:&lt;br /&gt;
Thinking over it again, if you&#039;re just looking for the data between the tags, this would probably be a better expression:&lt;br /&gt;
&lt;div class=&quot;codeblock&quot;&gt;&lt;code&gt;&amp;quot;/^.*&amp;lt;$tagname[^&amp;gt;]*&amp;gt;(.*)&amp;lt;\/$tagname&amp;gt;.*$/&amp;quot;&lt;/code&gt;&lt;/div&gt;&lt;/p&gt;
&lt;p&gt;As far as I understand, anything in parenthesis is captured when the expression is matched...&lt;/p&gt;
 </description>
     <pubDate>Thu, 09 Jul 2009 00:57:17 +0000</pubDate>
 <dc:creator>kazimmerman</dc:creator>
 <guid isPermaLink="false">comment 1243319 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title>Is the markup likely to be</title>
    <link>https://www.webmaster-forums.net/web-programming-and-application-development/extract-content-between-all-certain-html-tags-and-put-ar#comment-1243320</link>
    <description> &lt;p&gt;Is the markup likely to be well-formed?  If so, you can run it through a suitable HTML or XML parser.  Traverse the resulting DOM object to access the nodes you&#039;re interested in.  Look at the &lt;a href=&quot;http://php.net/simplexml&quot;&gt;SimpleXML&lt;/a&gt; extension for a start.&lt;/p&gt;
&lt;p&gt;For malformed markup, a regular expression may be best.  But if it&#039;s feasible, a simpler one which is more specific to the document will be easier to maintain and should work well enough.  Very general regexps like you&#039;ve posted will be hard to debug and adapt to changing inputs.&lt;/p&gt;
 </description>
     <pubDate>Wed, 08 Jul 2009 22:33:49 +0000</pubDate>
 <dc:creator>Abhishek Reddy</dc:creator>
 <guid isPermaLink="false">comment 1243320 at https://www.webmaster-forums.net</guid>
  </item>
  </channel>
</rss>
