<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-gb">
	<link rel="self" type="application/atom+xml" href="https://forum.eggheads.org/app.php/feed/topic/17155" />

	<title>egghelp/eggheads community</title>
	<subtitle>Discussion of eggdrop bots, shell accounts and tcl scripts.</subtitle>
	<link href="https://forum.eggheads.org/index.php" />
	<updated>2009-09-04T20:35:53-04:00</updated>

	<author><name><![CDATA[egghelp/eggheads community]]></name></author>
	<id>https://forum.eggheads.org/app.php/feed/topic/17155</id>

		<entry>
		<author><name><![CDATA[Sir_Fz]]></name></author>
		<updated>2009-09-04T20:35:53-04:00</updated>

		<published>2009-09-04T20:35:53-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=90163#p90163</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=90163#p90163"/>
		<title type="html"><![CDATA[regsub -nocase {} help]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=90163#p90163"><![CDATA[
The objective here is to have a valid regexp pattern, even though &lt; and &gt; have a special meaning in Tcl they won't be interpreted as such since they're in a string (and not in an expression), a single escape for a quotation is sufficient to return and match it. Basically, there's no need to complicate things, perhaps by trial and error you'll finally reach the desired result (if things get difficult).<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=3085">Sir_Fz</a> — Fri Sep 04, 2009 8:35 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[arfer]]></name></author>
		<updated>2009-09-04T05:42:47-04:00</updated>

		<published>2009-09-04T05:42:47-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=90153#p90153</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=90153#p90153"/>
		<title type="html"><![CDATA[regsub -nocase {} help]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=90153#p90153"><![CDATA[
Yes, Sir_Fz, I agree. In fact I pretty much said as much in one of my earlier posts under this thread. Patterns need to be modified to account for them being defined outside braces. Possibly the quotes would need to be double backslashed too, though without testing I'm not certain of that. Even the &lt; and &gt; from html tags look a mite dubious, since these characters have meaning in tcl.<br><br>This is exactly why I long ago chose to use the command subst where suitable. I simply made too many silly mistakes in switching between patterns inside braces and patterns outside braces. This is rather more likely to make me look foolish than using an extra command. I can't see an extra few milliseconds execution time as generally being an issue.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=5705">arfer</a> — Fri Sep 04, 2009 5:42 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Sir_Fz]]></name></author>
		<updated>2009-09-04T03:28:30-04:00</updated>

		<published>2009-09-04T03:28:30-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=90150#p90150</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=90150#p90150"/>
		<title type="html"><![CDATA[regsub -nocase {} help]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=90150#p90150"><![CDATA[
The \s issue can be avoided by adding an extra \ (i.e. \\s) and to avoid the array conflict use ${arg_date} instead.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=3085">Sir_Fz</a> — Fri Sep 04, 2009 3:28 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[arfer]]></name></author>
		<updated>2009-09-03T21:00:44-04:00</updated>

		<published>2009-09-03T21:00:44-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=90148#p90148</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=90148#p90148"/>
		<title type="html"><![CDATA[regsub -nocase {} help]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=90148#p90148"><![CDATA[
Your solution will probably not work for two reasons :-<br><br>The \s will be substituted in setting the variable and come out as simply s, thus negating its real meaning in the regsub pattern (space character).<br><br>The text portion $arg_date(.+) may be interpreted as an array. Since arg_date is not an array, an error will occur.<br><br>Thats my reading of it anyway.<br><br>I don't think the command subst is foolish in the right circumstances, but like I said, each to his own. The main thing is choosing an option that works.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=5705">arfer</a> — Thu Sep 03, 2009 9:00 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[speechles]]></name></author>
		<updated>2009-09-03T17:16:21-04:00</updated>

		<published>2009-09-03T17:16:21-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=90144#p90144</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=90144#p90144"/>
		<title type="html"><![CDATA[regsub -nocase {} help]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=90144#p90144"><![CDATA[
<blockquote class="uncited"><div><div class="codebox"><p>Code: </p><pre><code>regsub -nocase {.*&lt;a\s+href="b.php"&gt;$arg_date(.+)&lt;/b&gt;.*} $data {\1} data </code></pre></div></div></blockquote>Instead of this, you need to keep in mind substitution will not take place within { } bracings. So $arg_data is literally just that, not the contents of the variable named arg_data which prefixing the name with $ usually indicates.<div class="codebox"><p>Code: </p><pre><code>set dynamic_regexp ".*&lt;a\s+href="b.php"&gt;$arg_date(.+)&lt;/b&gt;.*"regsub -nocase -- $dynamic_regexp $data {\1} data </code></pre></div>This is the preferred method of doing it. Use the interpreter to do the substitution for you when creating the variable. Make sure to remember the rules of double-substitution which I will explain. Any escape (\) which needs rendering should be triple (\\\) escaped instead. This means any used for formatting that aren't really a command. All others make sure to escape a single time. This includes special chars "{[\]}'$ among a few others. Using them in the regexp would be as easy as \\\\\"\{\[ which would be substituted to "{[ before being used within the regexp, just keep that in mind. Escapes are special cases and 5 must be used if the sequence is to be rendered after the substitutions. If it were simply {hello}[there] we wanted \{hello\}\[there\] would work and the escape upon the second substitution would be removed. Or, if we wanted the escapes rendered into the regular expression \\\{hello\\\}\\\[there\\\] would produce \{hello\}\[there\] . It's explained much better by others just google "+double substitution +tcl" or "+double evaluation +tcl" and read up, this is how you construct these types of regular expressions.<br><br>To me, using [subst] is a crutch of sorts, sure it works but it makes you look foolish and it certainly won't win any speed or beauty races. Using switches to confine [subst]'s natural behavior -nocommands -etc -etc is meant when there is no other alternative to things. Not as a way to "avoid the situation". It's more an avoiding learning more so I can find an easier way and more of the "just stick with what works" approach. Which don't get me wrong, is viable as well. Just not as much so as, possibly... simply using what eggdrop gives you, rather than force substitutions through additional commands. ya know what i mean? <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8138">speechles</a> — Thu Sep 03, 2009 5:16 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[raider2k]]></name></author>
		<updated>2009-09-03T04:56:24-04:00</updated>

		<published>2009-09-03T04:56:24-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=90140#p90140</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=90140#p90140"/>
		<title type="html"><![CDATA[regsub -nocase {} help]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=90140#p90140"><![CDATA[
not sure if the following is what you are looking for, heres a try:<br><div class="codebox"><p>Code: </p><pre><code>set arg_date 15set data "&lt;tr bgcolor=#0099FF&gt;&lt;td align=center&gt;&lt;FONT SIZE='2' COLOR='#FFFFFF' face='verdana'&gt;&lt;a href='b.php'&gt;$arg_date&amp;periuk='"if { [regexp -all -nocase -- {.+\&lt;a href\=\'(.+?)&amp;periuk} $data -&gt; newurl] } {regsub -nocase -all {\&gt;} $newurl " " newurlregsub -nocase -all {\'} $newurl "" newurlset newurl [split $newurl]}set phpfile [lindex $newurl 0]set arg_date_new [lindex $newurl 1]puts "&lt;a href=\"$phpfile\"&gt;$arg_date_new"</code></pre></div>which returns<br><div class="codebox"><p>Code: </p><pre><code>(Tcl) 20 % source regextest.tcl&lt;a href="b.php"&gt;15(Tcl) 20 % </code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=9589">raider2k</a> — Thu Sep 03, 2009 4:56 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[walker]]></name></author>
		<updated>2009-09-03T04:51:51-04:00</updated>

		<published>2009-09-03T04:51:51-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=90139#p90139</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=90139#p90139"/>
		<title type="html"><![CDATA[regsub -nocase {} help]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=90139#p90139"><![CDATA[
<blockquote class="uncited"><div>It can be done by various means. Generally I choose the following method of including a variable within a regexp/regsub pattern<br><div class="codebox"><p>Code: </p><pre><code>regexp -- [subst -nocommands -nobackslashes {pattern here}] "text here"</code></pre></div>The above solution would require that a dollar symbol ($) never occurs elsewhere within the "text here", otherwise it will obviously be assumed to preceed a variable name.<br><br>The other alternative would be say to simply exclude the braces and define the pattern with this in mind. For example a \s meaning space would have to be written \\s and square brackets meaning a character set/range would have to be written \[a-z\] etc etc.<br><br>People seem to have their favourite methods of dealing with the problem.</div></blockquote>thanks bro. but 15 is a variable can be 13 or 31 or 30. depend on user request.<br><br>so, the script actually for grab user request like <strong class="text-strong">!date 15</strong> 15 used in regsub for search string in a html.<br><br>please help.....<br><br>do you have any yahoo messenger?[/b]<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=10842">walker</a> — Thu Sep 03, 2009 4:51 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[arfer]]></name></author>
		<updated>2009-09-03T04:45:04-04:00</updated>

		<published>2009-09-03T04:45:04-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=90138#p90138</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=90138#p90138"/>
		<title type="html"><![CDATA[regsub -nocase {} help]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=90138#p90138"><![CDATA[
It can be done by various means. Generally I choose the following method of including a variable within a regexp/regsub pattern<br><div class="codebox"><p>Code: </p><pre><code>regexp -- [subst -nocommands -nobackslashes {pattern here}] "text here"</code></pre></div>The above solution would require that a dollar symbol ($) never occurs elsewhere within the "text here", otherwise it will obviously be assumed to preceed a variable name.<br><br>The other alternative would be say to simply exclude the braces and define the pattern with this in mind. For example a \s meaning space would have to be written \\s and square brackets meaning a character set/range would have to be written \[a-z\] etc etc.<br><br>People seem to have their favourite methods of dealing with the problem.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=5705">arfer</a> — Thu Sep 03, 2009 4:45 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[walker]]></name></author>
		<updated>2009-09-03T04:28:24-04:00</updated>

		<published>2009-09-03T04:28:24-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=90137#p90137</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=90137#p90137"/>
		<title type="html"><![CDATA[regsub -nocase {} help]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=90137#p90137"><![CDATA[
<blockquote class="uncited"><div>The most likely issue here is that substitution of the variable named arg_date by its value using $arg_date will not occur because the braces that are surrounding the regsub pattern prevent normal variable, command and backslash substitution.</div></blockquote>so? it's imposibble to do that? please help<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=10842">walker</a> — Thu Sep 03, 2009 4:28 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[arfer]]></name></author>
		<updated>2009-09-03T04:23:19-04:00</updated>

		<published>2009-09-03T04:23:19-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=90136#p90136</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=90136#p90136"/>
		<title type="html"><![CDATA[regsub -nocase {} help]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=90136#p90136"><![CDATA[
The most likely issue here is that substitution of the variable named arg_date by its value using $arg_date will not occur because the braces that are surrounding the regsub pattern prevent normal variable, command and backslash substitution.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=5705">arfer</a> — Thu Sep 03, 2009 4:23 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[walker]]></name></author>
		<updated>2009-09-03T03:23:23-04:00</updated>

		<published>2009-09-03T03:23:23-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=90135#p90135</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=90135#p90135"/>
		<title type="html"><![CDATA[regsub -nocase {} help]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=90135#p90135"><![CDATA[
<blockquote class="uncited"><div>so you want to show everything between &lt;a href="b.php"&gt; and &lt;/b&gt;, but not show the rest of it?<br><br>please show me example content of your var $data and what it is meant to look like, Ill try to build something for you.</div></blockquote>too much line bro.<br><br>i thik how to make <strong class="text-strong">&lt;a\s+href="b.php"&gt;</strong> and <strong class="text-strong">$arg_date</strong> to be one<br><br>i want to be <strong class="text-strong">&lt;a href="b.php"&gt;15</strong> how it can be?<br><br>15 capture from <strong class="text-strong">set arg_date 15</strong> as a value from varible arg_date<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=10842">walker</a> — Thu Sep 03, 2009 3:23 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[raider2k]]></name></author>
		<updated>2009-09-03T02:40:36-04:00</updated>

		<published>2009-09-03T02:40:36-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=90134#p90134</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=90134#p90134"/>
		<title type="html"><![CDATA[regsub -nocase {} help]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=90134#p90134"><![CDATA[
so you want to show everything between &lt;a href="b.php"&gt; and &lt;/b&gt;, but not show the rest of it?<br><br>please show me example content of your var $data and what it is meant to look like, Ill try to build something for you.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=9589">raider2k</a> — Thu Sep 03, 2009 2:40 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[walker]]></name></author>
		<updated>2009-09-03T02:11:50-04:00</updated>

		<published>2009-09-03T02:11:50-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=90133#p90133</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=90133#p90133"/>
		<title type="html"><![CDATA[regsub -nocase {} help]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=90133#p90133"><![CDATA[
thanks bro raider2k, i must explain what i want to do.<br><div class="codebox"><p>Code: </p><pre><code>set arg_date 15regsub -nocase {.*&lt;a\s+href=\"b.php\"&gt;$arg_date(.+)&lt;/b&gt;.*} $data {\1} data putquick "PRIVMSG $chan :$data" </code></pre></div>i want to show all text between <strong class="text-strong">&lt;a href="b.php"&gt;15</strong> to <strong class="text-strong">&lt;/b&gt;</strong> with regsub command. <br><br><strong class="text-strong">15</strong> must inside variable <strong class="text-strong">arg_date</strong>.<br><br>please help. thank you so much<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=10842">walker</a> — Thu Sep 03, 2009 2:11 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[raider2k]]></name></author>
		<updated>2009-09-03T01:53:52-04:00</updated>

		<published>2009-09-03T01:53:52-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=90131#p90131</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=90131#p90131"/>
		<title type="html"><![CDATA[regsub -nocase {} help]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=90131#p90131"><![CDATA[
not sure what you are trying to do, but I put up this one and also returns $data<br><div class="codebox"><p>Code: </p><pre><code>set arg_date 15set data "&lt;tr bgcolor=#0099FF&gt;&lt;td align=center&gt;&lt;FONT SIZE='2' COLOR='#FFFFFF' face='verdana'&gt;$arg_date&amp;periuk="regsub -nocase {.+&lt;tr\s+bgcolor=\#0099FF&gt;&lt;td\s+align=center&gt;&lt;FONT SIZE=\'2\'\s+COLOR=\'\#FFFFFF\'\s+face=\'verdana\'&gt;.+&amp;periuk=.*} $data {\1} data puts "x $data"</code></pre></div>which returned:<br><div class="codebox"><p>Code: </p><pre><code>(Tcl) 1 % source regextest.tclx &lt;tr bgcolor=#0099FF&gt;&lt;td align=center&gt;&lt;FONT SIZE='2' COLOR='#FFFFFF' face='verdana'&gt;15&amp;periuk=(Tcl) 2 % </code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=9589">raider2k</a> — Thu Sep 03, 2009 1:53 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[walker]]></name></author>
		<updated>2009-09-03T01:14:56-04:00</updated>

		<published>2009-09-03T01:14:56-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=90130#p90130</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=90130#p90130"/>
		<title type="html"><![CDATA[regsub -nocase {} help]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=90130#p90130"><![CDATA[
i have code like this:<div class="codebox"><p>Code: </p><pre><code>set arg_date 15regsub -nocase {.*&lt;tr\s+bgcolor=\#0099FF&gt;&lt;td\s+align=center&gt;&lt;FONT SIZE=\'2\'\s+COLOR=\'\#FFFFFF\'\s+face=\'verdana\'&gt;$arg_date(.+)&amp;periuk=.*} $data {\1} data  putquick "PRIVMSG $chan :$data" </code></pre></div>why it's not working?? i think i wrong the code between <strong class="text-strong">\'verdana\'&gt;</strong> and <strong class="text-strong">(.+)&amp;periuk=</strong>. please help me. thank you....<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=10842">walker</a> — Thu Sep 03, 2009 1:14 am</p><hr />
]]></content>
	</entry>
	</feed>
