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

	<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-08-24T00:38:51-04:00</updated>

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

		<entry>
		<author><name><![CDATA[NewzNZ]]></name></author>
		<updated>2020-08-23T16:59:12-04:00</updated>

		<published>2020-08-23T16:59:12-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=108912#p108912</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=108912#p108912"/>
		<title type="html"><![CDATA[question &amp; exclaimation marks]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=108912#p108912"><![CDATA[
Hi - that's great thank you for the suggestions - will try those options...<br><br>Thank you again!<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=10525">NewzNZ</a> — Sun Aug 23, 2020 4:59 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[caesar]]></name></author>
		<updated>2020-08-24T00:38:51-04:00</updated>

		<published>2020-08-23T03:54:18-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=108907#p108907</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=108907#p108907"/>
		<title type="html"><![CDATA[question &amp; exclaimation marks]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=108907#p108907"><![CDATA[
What do you mean by filtering? If you mean to see if the string has any of the two then you got two options: <em class="text-italics">string index</em> or <em class="text-italics">regexp</em>.<br><br><em class="text-italics">string first</em><div class="codebox"><p>Code: </p><pre><code>% set text "something ! in here"something ! in here% string first "!" $text10</code></pre></div>notice that this returns the position of the needle in the haystack, so you need to do something like:<div class="codebox"><p>Code: </p><pre><code>if {[string first "!" $text] &gt; -1 || [string first "?" $text] &gt; -1} {# do something}</code></pre></div><em class="text-italics">regexp:</em><div class="codebox"><p>Code: </p><pre><code>% regexp -- {\!|\?} $text1</code></pre></div>notice that this one returns 0/1 (false or true) if any of the two is in there.<br><br>If you meant to replace/remove them from the string then you need <em class="text-italics">string map</em> like this:<div class="codebox"><p>Code: </p><pre><code>% string map {"!" ""} $textsomething  in here% set text "something ? in here"something ? in here% string map {"?" ""} $textsomething  in here</code></pre></div>Edit: Fixed a typo.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=187">caesar</a> — Sun Aug 23, 2020 3:54 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[NewzNZ]]></name></author>
		<updated>2020-08-22T23:07:06-04:00</updated>

		<published>2020-08-22T23:07:06-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=108906#p108906</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=108906#p108906"/>
		<title type="html"><![CDATA[question &amp; exclaimation marks]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=108906#p108906"><![CDATA[
Hi there<br><br>Am just trying to filter question marks or exclaimation marks in a string...just wondering if something like this is the right way about it:<div class="codebox"><p>Code: </p><pre><code>if {[string match {*\?*} $var] || [string match {*\!*} $var]} {         do some stuff here etc}</code></pre></div>Thanks in advance for any help!<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=10525">NewzNZ</a> — Sat Aug 22, 2020 11:07 pm</p><hr />
]]></content>
	</entry>
	</feed>
