<?xml version="1.0" encoding="utf-8" ?><rss version="2.0" xml:base="https://www.webmaster-forums.net/crss/node/1020392" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title></title>
    <link>https://www.webmaster-forums.net/crss/node/1020392</link>
    <description></description>
    <language>en</language>
          <item>
    <title></title>
    <link>https://www.webmaster-forums.net/serverside-scripting/how-curb-quantifiers-greediness#comment-1124736</link>
    <description> &lt;p&gt;Hi Mark&lt;/p&gt;
&lt;p&gt;I&#039;d use something like this to grab all image links and prepend an URL. (untested code):&lt;/p&gt;
&lt;p&gt;&lt;div class=&quot;codeblock&quot;&gt;&lt;code&gt;#!/usr/bin/perl&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; use strict;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; my $input_file = &amp;quot;input.html&amp;quot;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; my $image_location = &amp;quot;http://www.domain.com/&amp;quot;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; use HTML::TokeParser;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; my $p = HTML::TokeParser-&amp;gt;new($input_file);&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; while (my $token = $p-&amp;gt;get_tag(&amp;quot;img&amp;quot;)) {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; my $src = $token-&amp;gt;[1]{src};&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print $image_location . $src;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&amp;nbsp; &lt;/code&gt;&lt;/div&gt;&#039;&lt;/p&gt;
 </description>
     <pubDate>Mon, 03 Feb 2003 10:24:28 +0000</pubDate>
 <dc:creator>Wil</dc:creator>
 <guid isPermaLink="false">comment 1124736 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/serverside-scripting/how-curb-quantifiers-greediness#comment-1124713</link>
    <description> &lt;p&gt;I never got that deep into Perl.  Can you show me how HTML::TokeParser would work?&lt;/p&gt;
 </description>
     <pubDate>Sun, 02 Feb 2003 19:32:17 +0000</pubDate>
 <dc:creator>Mark Hensler</dc:creator>
 <guid isPermaLink="false">comment 1124713 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/serverside-scripting/how-curb-quantifiers-greediness#comment-1124708</link>
    <description> &lt;p&gt;Why not use HTML::TokeParser ?&lt;/p&gt;
 </description>
     <pubDate>Sun, 02 Feb 2003 13:05:34 +0000</pubDate>
 <dc:creator>Wil</dc:creator>
 <guid isPermaLink="false">comment 1124708 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title>thanks!</title>
    <link>https://www.webmaster-forums.net/serverside-scripting/how-curb-quantifiers-greediness#comment-1124707</link>
    <description> &lt;p&gt;Mark - thank you - it definitely works - someday I&#039;ll get around to try to understand *how* it works &lt;img src=&quot;https://www.webmaster-forums.net/misc/smileys/smile.png&quot; title=&quot;Smiling&quot; alt=&quot;Smiling&quot; class=&quot;smiley-content&quot; /&gt;&lt;/p&gt;
&lt;p&gt;Regarding the full path to images - I&#039;ve got a .cgi script in the cgi-bin dynamically creating a web page - without the full path the images will be looked for in the cgi-bin and will not display.&lt;/p&gt;
 </description>
     <pubDate>Sun, 02 Feb 2003 13:04:59 +0000</pubDate>
 <dc:creator>critical</dc:creator>
 <guid isPermaLink="false">comment 1124707 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/serverside-scripting/how-curb-quantifiers-greediness#comment-1124702</link>
    <description> &lt;p&gt;is it really a good idea to have the full path? it will make the site longer to load...&lt;/p&gt;
 </description>
     <pubDate>Sun, 02 Feb 2003 09:32:24 +0000</pubDate>
 <dc:creator>Renegade</dc:creator>
 <guid isPermaLink="false">comment 1124702 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/serverside-scripting/how-curb-quantifiers-greediness#comment-1124701</link>
    <description> &lt;p&gt;Woohoo, I love regex!&lt;/p&gt;
&lt;p&gt;input.html:&lt;br /&gt;
&lt;div class=&quot;codeblock&quot;&gt;&lt;code&gt;this is a line&lt;br /&gt;&amp;lt;img src=&amp;quot;sample.gif&amp;quot; height=&amp;quot;1&amp;quot; width=&amp;quot;1&amp;quot;&amp;gt;&lt;br /&gt;&amp;lt;b&amp;gt;this is line 3&amp;lt;/b&amp;gt;&lt;br /&gt;&amp;lt;input type=&amp;quot;image&amp;quot; src=&amp;quot;sample2.gif&amp;quot;&amp;gt;&lt;br /&gt;line 5&lt;/code&gt;&lt;/div&gt;&#039;&lt;/p&gt;
&lt;p&gt;test.pl:&lt;br /&gt;
&lt;div class=&quot;codeblock&quot;&gt;&lt;code&gt;#!/usr/bin/perl&lt;br /&gt;&lt;br /&gt;$input_file = &amp;quot;input.html&amp;quot;;&lt;br /&gt;$image_location = &amp;quot;http://www.domain.com/&amp;quot;;&lt;br /&gt;&lt;br /&gt;open (FILE, &amp;quot;$input_file&amp;quot;) || die (&amp;quot;Couldn&amp;#039;t open guestbook entries file.&amp;quot;);&lt;br /&gt;@input = &amp;lt;FILE&amp;gt;;&lt;br /&gt;close (FILE);&lt;br /&gt;&lt;br /&gt;foreach $html_line (@input) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; $html_line =~ s/(([&amp;#039;])?([&amp;quot;])?)((?(2)([^&amp;#039;]+?)|([^&amp;quot;]+?))\.gif)(?(2)&amp;#039;|&amp;quot;)/$1$image_location$4$1/g;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; print $html_line;&lt;br /&gt;}&lt;/code&gt;&lt;/div&gt;&#039;&lt;/p&gt;
&lt;p&gt;output:&lt;br /&gt;
&lt;div class=&quot;codeblock&quot;&gt;&lt;code&gt;this is a line&lt;br /&gt;&amp;lt;img src=&amp;quot;http://www.domain.com/sample.gif&amp;quot; height=&amp;quot;1&amp;quot; width=&amp;quot;1&amp;quot;&amp;gt;&lt;br /&gt;&amp;lt;b&amp;gt;this is line 3&amp;lt;/b&amp;gt;&lt;br /&gt;&amp;lt;input type=&amp;quot;image&amp;quot; src=&amp;quot;http://www.domain.com/sample2.gif&amp;quot;&amp;gt;&lt;br /&gt;line 5&lt;/code&gt;&lt;/div&gt;&#039;&lt;br /&gt;
I haven&#039;t used perl much lately.  I can remember how to say &quot;I want a single or double quote, then a string, then another quote like the one I got before&quot;.  So I did it the round about way.  Not bullet proof, but it passed my simple input.html test.  I can write a better PHP script because I know how to do the quote matching there. &lt;img src=&quot;https://www.webmaster-forums.net/misc/smileys/eyeroll.png&quot; title=&quot;Roll eyes&quot; alt=&quot;Roll eyes&quot; class=&quot;smiley-content&quot; /&gt;&lt;/p&gt;
 </description>
     <pubDate>Sun, 02 Feb 2003 08:23:35 +0000</pubDate>
 <dc:creator>Mark Hensler</dc:creator>
 <guid isPermaLink="false">comment 1124701 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/serverside-scripting/how-curb-quantifiers-greediness#comment-1124700</link>
    <description> &lt;p&gt;Maybe it&#039;s mistaking TYPE for SRC.&lt;/p&gt;
 </description>
     <pubDate>Sun, 02 Feb 2003 04:57:59 +0000</pubDate>
 <dc:creator>necrotic</dc:creator>
 <guid isPermaLink="false">comment 1124700 at https://www.webmaster-forums.net</guid>
  </item>
  </channel>
</rss>
