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

	<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-12T15:06:31-04:00</updated>

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

		<entry>
		<author><name><![CDATA[strikelight]]></name></author>
		<updated>2003-04-12T15:06:31-04:00</updated>

		<published>2003-04-12T15:06:31-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=19002#p19002</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=19002#p19002"/>
		<title type="html"><![CDATA[Take words from a sentence (help)]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=19002#p19002"><![CDATA[
Your original post is a bit confusing as to what you want exactly..<br><br>From your example, if you only wanted 'George and I am 27',<br>I would recommend using:<br><div class="codebox"><p>Code: </p><pre><code>regexp -nocase {name is (.*) years} garbage sentence</code></pre></div>And the contents of $sentence would then be 'George and I am 27' from your given example data.<br><br>However, you went on to say 'from George until the end'.. If this is the case, I would recommend simply using:<br><div class="codebox"><p>Code: </p><pre><code>regexp -nocase {name is (.*)} garbage sentence</code></pre></div>And $sentence would then contain from the name until the end of the sentence.<br><br>For more information, consult the re_syntax part of TCL Manpages.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2005">strikelight</a> — Sat Apr 12, 2003 3:06 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[ppslim]]></name></author>
		<updated>2003-04-12T07:58:34-04:00</updated>

		<published>2003-04-12T07:58:34-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=18955#p18955</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=18955#p18955"/>
		<title type="html"><![CDATA[Take words from a sentence (help)]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=18955#p18955"><![CDATA[
The regexp is not needed, join and split are fine.<br><br>First you split the string into a list, so you can operate on it in a array like fassion.<br><br>One you have finished with it as a list, and need a string again, you use the join command.<br><br>In this, treat the incoming text as $text<div class="codebox"><p>Code: </p><pre><code>#Convert strin to list, and place it back in the same variableset text [split $text]#extract using lrangeset part [lrange $text 4 end]#Now convert $part to a string so the characters do not look garbled.set part [join $part]</code></pre></div>However, this doesn't cover extracting the details you wanted.<br><br>Because of the way the 2 sentaces are structured (differently), ity would take some form of AI system, to know what part of the text is what.<br><br>If you know of a script, be it in another language, that can do this, paste it here, we can try and convert it to Tcl.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2">ppslim</a> — Sat Apr 12, 2003 7:58 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[caesar]]></name></author>
		<updated>2003-04-12T06:15:20-04:00</updated>

		<published>2003-04-12T06:15:20-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=18948#p18948</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=18948#p18948"/>
		<title type="html"><![CDATA[Take words from a sentence (help)]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=18948#p18948"><![CDATA[
Or see/use the "lrange" <a href="http://tcl.activestate.com/man/tcl8.2.3/TclCmd/lrange.htm" class="postlink">here</a>..<br>eg: set bla [lrange $text 4 end]<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=187">caesar</a> — Sat Apr 12, 2003 6:15 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Dereckson]]></name></author>
		<updated>2003-04-12T05:07:45-04:00</updated>

		<published>2003-04-12T05:07:45-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=18941#p18941</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=18941#p18941"/>
		<title type="html"><![CDATA[Take words from a sentence (help)]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=18941#p18941"><![CDATA[
Instead join/split, you need something convert CORRECTLY your string into a list.<br><br>This is the solution I use :<br><div class="codebox"><p>Code: </p><pre><code>proc splitwords {string} { set return ""foreach word [regexp -inline -all -- {\S+} $string] { lappend return $word} return $return}</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=1339">Dereckson</a> — Sat Apr 12, 2003 5:07 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[cerberus_gr]]></name></author>
		<updated>2003-04-09T11:50:55-04:00</updated>

		<published>2003-04-09T11:50:55-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=18789#p18789</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=18789#p18789"/>
		<title type="html"><![CDATA[Take words from a sentence (help)]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=18789#p18789"><![CDATA[
Hello,<br><br>which command do we use, if we have a sentence like "word1 word2 word3 word4 word5 word6" and we want<br>to save to a variable only "word2 word3 word4"? We don't know the number of words, but only which are these words.<br><br><strong class="text-strong">Example</strong><br>sentence 1 -&gt; My name is George and I am 27 years old.<br>sentence 2 -&gt; My first name is George and I am 27 years old and I live...<br>need          -&gt; George and I am 27<br><br>If I want to save to a variable the sentence from George <span style="text-decoration:underline">until the end</span>?<br><br>What should I do if the sentence has characters such as ", [. { etc.<br>Should I use join and split command?<br><br>thx<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2661">cerberus_gr</a> — Wed Apr 09, 2003 11:50 am</p><hr />
]]></content>
	</entry>
	</feed>
