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

	<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>2020-06-22T01:22:31-04:00</updated>

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

		<entry>
		<author><name><![CDATA[simo]]></name></author>
		<updated>2020-06-07T22:55:41-04:00</updated>

		<published>2020-06-07T22:55:41-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=108510#p108510</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=108510#p108510"/>
		<title type="html"><![CDATA[detect nicks with excessive digits in it]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=108510#p108510"><![CDATA[
Tnx crazycat after taking a look again i saw its working and its exactly what was desired another fine job from caesar tnx again caesar much appreciated as always<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=12505">simo</a> — Sun Jun 07, 2020 10:55 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[CrazyCat]]></name></author>
		<updated>2020-06-07T17:58:39-04:00</updated>

		<published>2020-06-07T17:58:39-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=108509#p108509</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=108509#p108509"/>
		<title type="html"><![CDATA[detect nicks with excessive digits in it]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=108509#p108509"><![CDATA[
<blockquote class="uncited"><div>im not sure what that does ceasar but what we was looking for was to count digits in nick and if exceeding like 6 or higher to take action</div></blockquote>What does ceasar is quite simple: he replaces all characters which are not between 0 to 9 with nothing and count the length of the resulting string.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=691">CrazyCat</a> — Sun Jun 07, 2020 5:58 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[simo]]></name></author>
		<updated>2020-06-06T10:34:56-04:00</updated>

		<published>2020-06-06T10:34:56-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=108508#p108508</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=108508#p108508"/>
		<title type="html"><![CDATA[detect nicks with excessive digits in it]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=108508#p108508"><![CDATA[
tested it again seems to work now<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=12505">simo</a> — Sat Jun 06, 2020 10:34 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[simo]]></name></author>
		<updated>2020-06-06T08:39:57-04:00</updated>

		<published>2020-06-06T08:39:57-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=108507#p108507</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=108507#p108507"/>
		<title type="html"><![CDATA[detect nicks with excessive digits in it]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=108507#p108507"><![CDATA[
im not sure what that does ceasar but what we was looking for was to count digits in nick and if exceeding like 6 or higher to take action<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=12505">simo</a> — Sat Jun 06, 2020 8:39 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[caesar]]></name></author>
		<updated>2020-06-06T03:23:16-04:00</updated>

		<published>2020-06-06T03:23:16-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=108506#p108506</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=108506#p108506"/>
		<title type="html"><![CDATA[detect nicks with excessive digits in it]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=108506#p108506"><![CDATA[
<div class="codebox"><p>Code: </p><pre><code>% set nick "f2A94d"f2A94d% regsub -all {[^0-9]} $nick ""294% string length [regsub -all {[^0-9]} $nick ""]3% set nick "aaaa3db4"aaaa3db4% string length [regsub -all {[^0-9]} $nick ""]2</code></pre></div>isn't this what you where looking for?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=187">caesar</a> — Sat Jun 06, 2020 3:23 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[simo]]></name></author>
		<updated>2020-06-05T13:31:00-04:00</updated>

		<published>2020-06-05T13:31:00-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=108503#p108503</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=108503#p108503"/>
		<title type="html"><![CDATA[detect nicks with excessive digits in it]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=108503#p108503"><![CDATA[
<blockquote class="uncited"><div>that removes any character that isn't in the 0 to 9 range and then returns it's length.</div></blockquote>but we wanted to count the digits in the nick to check for amount of digits<br><br>as this seems to count the length of the nick and not the amount of digits in it:<br><div class="codebox"><p>Code: </p><pre><code>if {[string length [regsub -all {[^0-9]} $nick ""]] &gt; 6} {   # do whatever}</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=12505">simo</a> — Fri Jun 05, 2020 1:31 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[caesar]]></name></author>
		<updated>2020-06-22T01:22:31-04:00</updated>

		<published>2020-06-05T01:27:17-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=108498#p108498</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=108498#p108498"/>
		<title type="html"><![CDATA[detect nicks with excessive digits in it]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=108498#p108498"><![CDATA[
The code you mentioned returns the digits from the string, not it's length, hence why i suggested the initial code:<div class="codebox"><p>Code: </p><pre><code>if {[string length [regsub -all {[^0-9]} $nick ""]] &gt; 6} {   # do whatever}</code></pre></div>that removes any character that isn't in the 0 to 9 range and then returns it's length.<br><br>Anyway, there are 3 options to get the digits from a string:<br><br>1. regsub<br>2. regexp<br>3. split, loop and compare<br><div class="codebox"><p>Code: </p><pre><code>% set text "f2A94d"f2A94d% regsub -all {[^0-9]} $text ""294% join [regexp -all -inline -- {[0-9]+} $text] ""294% join [regexp -all -inline -- {\d+} $text] ""294% foreach e [split $text ""] {        if {[string is integer $e]} {                append result $e        }}% puts $result294</code></pre></div>Now, if you want to see who's faster, or if you wonder if that regsub is slow:<div class="codebox"><p>Code: </p><pre><code>% time { regsub -all {[^0-9]} $text "" } 10003.553 microseconds per iteration% time { join [regexp -all -inline -- {\d+} $text] "" } 10003.457 microseconds per iteration% time { join [regexp -all -inline -- {[0-9]+} $text] "" } 10003.939 microseconds per iteration% time { foreach e [split $text ""] { if {[string is integer $e]} { append result $e } } } 100010.051 microseconds per iteration% time { foreach e [split $text ""] { if {[string is integer $e]} { append result $e } } } 10008.604 microseconds per iteration% time { foreach e [split $text ""] { if {[string is integer $e]} { append result $e } } } 10009.156 microseconds per iteration% time { foreach e [split $text ""] { if {[string is integer $e]} { append result $e } } } 10006.549 microseconds per iteration% time { foreach e [split $text ""] { if {[string is integer $e]} { append result $e } } } 10009.37 microseconds per iteration</code></pre></div>Right off the bat we see two possible candidates, so we try again with 10000 times:<div class="codebox"><p>Code: </p><pre><code>% time { regsub -all {[^0-9]} $text "" } 100002.5413 microseconds per iteration% time { join [regexp -all -inline -- {\d+} $text] "" } 100002.7552 microseconds per iteration</code></pre></div>Hope this answers your question. <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"><br><br>Edit: We can use <em class="text-italics">scan</em> instead of <em class="text-italics">string is integer</em><div class="codebox"><p>Code: </p><pre><code>% foreach e [split $text ""] {        if {[scan $e {%d} no] &gt; 0} {                append result $e        }}% puts $result294</code></pre></div>but given that it's a loop will still take a lot longer than regsub or regexp:<div class="codebox"><p>Code: </p><pre><code>% time { unset result; foreach e [split $text ""] { if {[scan $e {%d} no] &gt; 0} { append result $e} } } 100011.501 microseconds per iteration% time { unset result; foreach e [split $text ""] { if {[scan $e {%d} no] &gt; 0} { append result $e} } } 100013.495 microseconds per iteration% time { unset result; foreach e [split $text ""] { if {[scan $e {%d} no] &gt; 0} { append result $e} } } 100013.228 microseconds per iteration</code></pre></div><br>Edit: Actually the code you tried:<div class="codebox"><p>Code: </p><pre><code>   if {[regexp -all {[0-9]} $nick] &gt; 6} {       #do whatever here}</code></pre></div>returns the length of digits from 0 to 9 it finds in $nick variable. Duno at what was looking at when did the initial test. /facepalm<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=187">caesar</a> — Fri Jun 05, 2020 1:27 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[simo]]></name></author>
		<updated>2020-06-04T23:42:35-04:00</updated>

		<published>2020-06-04T23:42:35-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=108497#p108497</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=108497#p108497"/>
		<title type="html"><![CDATA[detect nicks with excessive digits in it]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=108497#p108497"><![CDATA[
i tried this <br><div class="codebox"><p>Code: </p><pre><code>if {[regexp -all {[0-9]} $nick] &gt; 6} {       do whatever here}</code></pre></div>it does seem to work not sure if its proper and not  sure if its fastest ? since from what i keep hearing is regexp might not be the fastest to process<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=12505">simo</a> — Thu Jun 04, 2020 11:42 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[simo]]></name></author>
		<updated>2020-06-04T23:17:12-04:00</updated>

		<published>2020-06-04T23:17:12-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=108496#p108496</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=108496#p108496"/>
		<title type="html"><![CDATA[detect nicks with excessive digits in it]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=108496#p108496"><![CDATA[
its old topic but i tried this one again and it seems it counts general chars lenght and not the amount of digits anywhere in the nick<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=12505">simo</a> — Thu Jun 04, 2020 11:17 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[simo]]></name></author>
		<updated>2016-12-08T16:43:15-04:00</updated>

		<published>2016-12-08T16:43:15-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=105611#p105611</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=105611#p105611"/>
		<title type="html"><![CDATA[detect nicks with excessive digits in it]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=105611#p105611"><![CDATA[
tested it and works fine thnx caesar<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=12505">simo</a> — Thu Dec 08, 2016 4:43 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[caesar]]></name></author>
		<updated>2016-12-08T02:09:54-04:00</updated>

		<published>2016-12-08T02:09:54-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=105603#p105603</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=105603#p105603"/>
		<title type="html"><![CDATA[detect nicks with excessive digits in it]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=105603#p105603"><![CDATA[
<div class="codebox"><p>Code: </p><pre><code>if {[string length [regsub -all {[^0-9]} $nick ""]] &gt; 6} {# do whatever}</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=187">caesar</a> — Thu Dec 08, 2016 2:09 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[simo]]></name></author>
		<updated>2019-03-03T12:25:25-04:00</updated>

		<published>2016-12-07T13:23:58-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=105602#p105602</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=105602#p105602"/>
		<title type="html"><![CDATA[detect nicks with excessive digits in it]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=105602#p105602"><![CDATA[
is it possible to have  tcl check for digits like more than 6 digits anywhere in the nick<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=12505">simo</a> — Wed Dec 07, 2016 1:23 pm</p><hr />
]]></content>
	</entry>
	</feed>
