<?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/4060" />

	<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>2003-04-07T14:47:29-04:00</updated>

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

		<entry>
		<author><name><![CDATA[user]]></name></author>
		<updated>2003-04-07T14:47:29-04:00</updated>

		<published>2003-04-07T14:47:29-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=18686#p18686</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=18686#p18686"/>
		<title type="html"><![CDATA[String comparison]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=18686#p18686"><![CDATA[
the best way to determine if two strings are equal is...drumroll... 'string equal' ..it even has a -nocase option <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=2878">user</a> — Mon Apr 07, 2003 2:47 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[ppslim]]></name></author>
		<updated>2003-04-06T16:38:45-04:00</updated>

		<published>2003-04-06T16:38:45-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=18648#p18648</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=18648#p18648"/>
		<title type="html"><![CDATA[String comparison]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=18648#p18648"><![CDATA[
Read the Tcl man pages for the usage of the "string match" command.<br><br>it uses the format<br><blockquote class="uncited"><div>string match [-nocase] &lt;mask&gt; &lt;string&gt;</div></blockquote>The mask is the first item, not the second. Thus, because $channel isn't escaped, and is being passed as the mask potion, it is failing.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2">ppslim</a> — Sun Apr 06, 2003 4:38 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[stdragon]]></name></author>
		<updated>2003-04-05T03:47:16-04:00</updated>

		<published>2003-04-05T03:47:16-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=18609#p18609</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=18609#p18609"/>
		<title type="html"><![CDATA[String comparison]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=18609#p18609"><![CDATA[
Ok... the mask is $channel<br><br>The text is "#\[ms\]"<br><br>See, you escaped the [ ] in the text, but not the mask.<br><br>Solution: use "string compare" instead of "string match" (look it up in the man page) because it doesn't use a mask, and hence doesn't need to be escaped.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8">stdragon</a> — Sat Apr 05, 2003 3:47 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Massacre]]></name></author>
		<updated>2003-04-05T03:45:50-04:00</updated>

		<published>2003-04-05T03:45:50-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=18608#p18608</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=18608#p18608"/>
		<title type="html"><![CDATA[String comparison]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=18608#p18608"><![CDATA[
:s well i just tried:<br><div class="codebox"><p>Code: </p><pre><code>if {[string match -nocase $channel "#\[ms\]"]} {putquick "PRIVMSG $channel :Test(1)"}if {[string match -nocase $channel "#\[ms]"]} {putquick "PRIVMSG $channel :Test(2)"}</code></pre></div>and neither appeared in the channel. :/ The compare thing works though. Thnx for ur time guys.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2880">Massacre</a> — Sat Apr 05, 2003 3:45 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[caesar]]></name></author>
		<updated>2003-04-05T03:28:02-04:00</updated>

		<published>2003-04-05T03:28:02-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=18607#p18607</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=18607#p18607"/>
		<title type="html"><![CDATA[String comparison]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=18607#p18607"><![CDATA[
Evidently that will not. I did a test: .tcl putlog "#\[ms\]" and got as result: #[ms] Test yourself.. Oh and also it works if you use only one \ like: #\[ms]<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=187">caesar</a> — Sat Apr 05, 2003 3:28 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Massacre]]></name></author>
		<updated>2003-04-05T03:19:21-04:00</updated>

		<published>2003-04-05T03:19:21-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=18606#p18606</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=18606#p18606"/>
		<title type="html"><![CDATA[String comparison]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=18606#p18606"><![CDATA[
Isn't "#\[ms\]" excaping the []?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2880">Massacre</a> — Sat Apr 05, 2003 3:19 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[stdragon]]></name></author>
		<updated>2003-04-04T18:37:05-04:00</updated>

		<published>2003-04-04T18:37:05-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=18601#p18601</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=18601#p18601"/>
		<title type="html"><![CDATA[String comparison]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=18601#p18601"><![CDATA[
Escaping [ ] would get around it, but you didn't escape it (in the mask).<br><br>Using string compare like I said will get around it just fine.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8">stdragon</a> — Fri Apr 04, 2003 6:37 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Massacre]]></name></author>
		<updated>2003-04-04T18:21:40-04:00</updated>

		<published>2003-04-04T18:21:40-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=18600#p18600</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=18600#p18600"/>
		<title type="html"><![CDATA[String comparison]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=18600#p18600"><![CDATA[
Doesn't escaping (eg, '\[') get round that? And if not, do you or anyone else know how i can get round it?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2880">Massacre</a> — Fri Apr 04, 2003 6:21 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[stdragon]]></name></author>
		<updated>2003-04-04T18:16:02-04:00</updated>

		<published>2003-04-04T18:16:02-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=18599#p18599</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=18599#p18599"/>
		<title type="html"><![CDATA[String comparison]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=18599#p18599"><![CDATA[
I believe [ ] has special meaning when used as a mask in string match. It means basically "any of the enclosed chars." Solution: use [string compare] instead.<br><br>% string match {[abc]} "a"<br>1<br>% string match {[abc]} "b"<br>1<br>% string match {[abc]} "e"<br>0<br>% string compare {[abc]} "a"<br>-1<br>% string compare {[abc]} {[abc]}<br>0 &lt;-- correct<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8">stdragon</a> — Fri Apr 04, 2003 6:16 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Massacre]]></name></author>
		<updated>2003-04-04T17:40:37-04:00</updated>

		<published>2003-04-04T17:40:37-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=18598#p18598</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=18598#p18598"/>
		<title type="html"><![CDATA[String comparison]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=18598#p18598"><![CDATA[
i've tried it with other channels there too, but it only failes on #[ms] :/<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2880">Massacre</a> — Fri Apr 04, 2003 5:40 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Massacre]]></name></author>
		<updated>2003-04-04T17:39:01-04:00</updated>

		<published>2003-04-04T17:39:01-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=18597#p18597</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=18597#p18597"/>
		<title type="html"><![CDATA[String comparison]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=18597#p18597"><![CDATA[
I just don't get it. I've spent the best part of 2 hours fiddling with this and I just can't see why it's not working. If I join our clan channel, #[ms], the following, which is in a proc that's bound to 'join' (and i know it works), results in false<br><div class="codebox"><p>Code: </p><pre><code>if {[string match -nocase $channel "#\[ms\]"]} {</code></pre></div>or, from my debugging:<br><div class="codebox"><p>Code: </p><pre><code>putquick "PRIVMSG $channel :$channel [string match -nocase $channel "#\[ms\]"]"</code></pre></div>gives the output: #[ms] 0<br><br>If i replace #[ms] with our private channel then join the private channel, the if results in true, but otherwise, it just doesn't work. It's not in any other if's, it's just there and it isn't working :S can anyone see something i'm doing wrong? i'd be very greatful!<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2880">Massacre</a> — Fri Apr 04, 2003 5:39 pm</p><hr />
]]></content>
	</entry>
	</feed>
