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

	<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>2024-03-28T12:33:36-04:00</updated>

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

		<entry>
		<author><name><![CDATA[simo]]></name></author>
		<updated>2024-03-28T12:33:36-04:00</updated>

		<published>2024-03-28T12:33:36-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=112662#p112662</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=112662#p112662"/>
		<title type="html"><![CDATA[Re: badwords tcl with regexp]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=112662#p112662"><![CDATA[
thanks CC<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=12505">simo</a> — Thu Mar 28, 2024 12:33 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[CrazyCat]]></name></author>
		<updated>2024-03-28T11:03:51-04:00</updated>

		<published>2024-03-28T11:03:51-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=112661#p112661</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=112661#p112661"/>
		<title type="html"><![CDATA[Re: badwords tcl with regexp]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=112661#p112661"><![CDATA[
Regexp synopsis: regexp ?switches? exp string ?matchVar? ?subMatchVar subMatchVar ...?<br>You use bword as exp (must be a regular expression) and textedit as string (must not be a regular expression).<br><br>you'd better transform bword rather than textedit:<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/styles/atom-one-dark-reasonable.min.css"> <strong>script</strong>  <strong>script</strong> <div class="codebox"><pre><code class="language-tcl">% set bword "test"test% set textedit "I'am a test0r gonna testing"I'am a test0r gonna testing# What you do% set textedit [string map {o [0o] u [uv] i [i1] e [3e] a [a4]} $textedit]I'[a4]m [a4] t[3e]st0r g[0o]nn[a4] t[3e]st[i1]ng% regexp -nocase $bword $textedit0# bad :)# What I do% set textedit "I'am a test0r gonna testing"I'am a test0r gonna testing% set bword [string map {o [0o] u [uv] i [i1] e [3e] a [a4]} $bword]t[3e]st% regexp -nocase $bword $textedit1#good</code></pre></div> <strong>script</strong> Small addition: use -all:<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/styles/atom-one-dark-reasonable.min.css"> <strong>script</strong>  <strong>script</strong> <div class="codebox"><pre><code class="language-tcl">% regexp -all -nocase $bword $textedit2</code></pre></div> <strong>script</strong> <p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=691">CrazyCat</a> — Thu Mar 28, 2024 11:03 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[simo]]></name></author>
		<updated>2024-03-28T10:49:17-04:00</updated>

		<published>2024-03-28T10:49:17-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=112660#p112660</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=112660#p112660"/>
		<title type="html"><![CDATA[badwords tcl with regexp]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=112660#p112660"><![CDATA[
greetz, i was trying out this small badwords tcl with regexp the idea is to have it strip colorscodes bold and such and strip from duplicate characters and non alphabetical/digit and have comon chars replaces wich are often used to evade badwords like 0 for o 3 for e and such and after all that to have it match against the text but for some reason it seems to trigger regardless of what text is used.<br><div class="codebox"><p>Code: </p><pre><code>set badwords {"*censored*""somebadword"}bind pubm - * text:badwordsproc text:badwords {nick uhost hand chan text} {global badwordsset text [regsub -all -- {\s{2,}} [string trim [stripcodes * $text]] { }]regsub -all -- {(.)\1+} $text {\1} textregsub -all -nocase {[^a-z0-9]+} $text "" texteditset textedit [string map {o [0o] u [uv] i [i1] e [3e] a [a4]} $text]set banmask "*!*@[lindex [split $uhost @] 1]"foreach bword $badwords {if {[regexp -nocase {[$bword]} $textedit]} {pushmode $chan +b  m:$banmask}}}</code></pre></div>not sure where i went wrong i suspect the line : if {[regexp -nocase {[$bword]} $textedit]} {<br><br>but im not sure what the proper method would be to use that line in this case since we test text matched against like [0o] [3e] i thought its proper to use regexp for it unless there is a better way.<br><br>hope someone might have a solution.<br><br>apreciated,<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=12505">simo</a> — Thu Mar 28, 2024 10:49 am</p><hr />
]]></content>
	</entry>
	</feed>
