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

	<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>2012-12-05T15:57:27-04:00</updated>

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

		<entry>
		<author><name><![CDATA[maphex]]></name></author>
		<updated>2012-12-05T15:57:27-04:00</updated>

		<published>2012-12-05T15:57:27-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=100367#p100367</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=100367#p100367"/>
		<title type="html"><![CDATA[HELP! Regexp/Regsub]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=100367#p100367"><![CDATA[
Thanks for all the help. I got it working with some modifications to the code to not use a pubm and used a regular bind pub and still used the split text that Nimos provided.<br><br>I decided against the regexp method because of overlapping binds using pubm unless there is something i missed to stop this<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=11913">maphex</a> — Wed Dec 05, 2012 3:57 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Nimos]]></name></author>
		<updated>2012-12-05T12:00:57-04:00</updated>

		<published>2012-12-05T12:00:57-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=100364#p100364</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=100364#p100364"/>
		<title type="html"><![CDATA[HELP! Regexp/Regsub]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=100364#p100364"><![CDATA[
<div class="codebox"><p>Code: </p><pre><code>   if {[regexp -nocase -- {^!.* .*$} $text]} {            set trigger [lindex [split $text] 0]      set search [lrange [split $text] 1 end]         regsub -all -- {\*} $search % search             set searchvar [list]       foreach word $search {          lappend searchvar db.`searchcolum` like '%[mysqlescape $word]%'"       }           do sql stuff like getting results         where [join $searchvar " AND " ]    AND SearchChannel LIKE '#%$searchchan%'    } </code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=9877">Nimos</a> — Wed Dec 05, 2012 12:00 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[maphex]]></name></author>
		<updated>2012-12-05T02:22:23-04:00</updated>

		<published>2012-12-05T02:22:23-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=100362#p100362</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=100362#p100362"/>
		<title type="html"><![CDATA[HELP! Regexp/Regsub]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=100362#p100362"><![CDATA[
Could you provide me with an example? I understand a little better when its laid out and can see how it works? Thanks for the fast response!<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=11913">maphex</a> — Wed Dec 05, 2012 2:22 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[SpiKe^^]]></name></author>
		<updated>2012-12-04T22:15:11-04:00</updated>

		<published>2012-12-04T22:15:11-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=100361#p100361</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=100361#p100361"/>
		<title type="html"><![CDATA[HELP! Regexp/Regsub]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=100361#p100361"><![CDATA[
Why not simply use [split $text] on the text. <br>Then [lindex $text 0] would be the first word and [lrange $text 1 end] would be all the other words, still as a list.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=7749">SpiKe^^</a> — Tue Dec 04, 2012 10:15 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[maphex]]></name></author>
		<updated>2012-12-04T21:22:33-04:00</updated>

		<published>2012-12-04T21:22:33-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=100360#p100360</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=100360#p100360"/>
		<title type="html"><![CDATA[HELP! Regexp/Regsub]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=100360#p100360"><![CDATA[
So what im trying to do here is make a trigger that is based on a SQL entry.<br>So the first !(.*) will be the trigger.<br>Then I want the next  (.*) to be the search term(s).<br><br>Everything works fine if the search term is one word but if the term is broken by a space like !searchchan search words here the script fails.<br><br>So I need to make it take the second (.*) and extend to the end of the line and save it as a var. Then the regsub will then take it and break it into usable content the rest of the script can use.<br><div class="codebox"><p>Code: </p><pre><code>    bind pubm - * bind_search    proc bind_search {nick uhost handle channel text} {       filter_mirc_codesset regexp {^!(.*) (.*) *$}if {[regexp -nocase -- $regexp $text -&gt; searchchan search]} {  regsub -all -- {\*} $search % searchset searchvar [list]foreach word [split $search] {lappend searchvar db.`searchcolum` like '%[mysqlescape $word]%'"}do sql stuff like getting results         where [join $searchvar " AND " ]AND SearchChannel LIKE '#%$searchchan%'}}</code></pre></div>Added this just in case someone need to know theproc for the filter_mirc_codes<br><div class="codebox"><p>Code: </p><pre><code>    proc filter_mirc_codes {} {      upvar text text      regsub -all -- "(\002|\017|\026|\037|\003(\[0-9\]\[0-9\]?(,\[0-9\]\[0-9\]?)?)?)"  $text "" text}</code></pre></div>Big thanks in advance! I am open to other options that maybe fast or cleaner to the way I am doing it.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=11913">maphex</a> — Tue Dec 04, 2012 9:22 pm</p><hr />
]]></content>
	</entry>
	</feed>
