<HTML><BODY style="word-wrap: break-word; -khtml-nbsp-mode: space; -khtml-line-break: after-white-space; "><BR><DIV><DIV>On 28 Feb 2006, at 17:42, Dr. Drang wrote:</DIV><DIV><BR class="khtml-block-placeholder"></DIV><BR class="Apple-interchange-newline"><BLOCKQUOTE type="cite"><BLOCKQUOTE type="cite"> </BLOCKQUOTE><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><BR></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">Clever! And if I'm reading your code correctly, you're updating from the last number but still allowing the user to override, which is nice.</DIV></BLOCKQUOTE></DIV><BR class="khtml-block-placeholder"><DIV><BR class="khtml-block-placeholder"></DIV><DIV>Yes, because I sometimes use something else than numbers like e.g. [mail].</DIV><DIV>And if it's the first numerical reference, it proposes "1".</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>BTW, the second reference I make to #{n} was not necessary, I removed it.</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV><FONT class="Apple-style-span" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;">#!/usr/bin/env ruby</SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;"><BR class="khtml-block-placeholder"></SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;">str = STDIN.read</SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;">n = str.scan( %r{.*\[(\d+)\]: }m ).to_s.to_i + 1</SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;">print "[${1:description}][${2:#{n}}]$0" + str.gsub(/[$`\\]/, '\\\\\1') + "[<FONT class="Apple-style-span" color="#2D8A53">$2</FONT>]: ${3:http://}\n"</SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;"><BR class="khtml-block-placeholder"></SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;">--</SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" face="Monaco" size="3"><SPAN class="Apple-style-span" style="font-size: 11px;">FredB</SPAN></FONT></DIV></BODY></HTML>