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

	<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>2007-08-05T20:29:23-04:00</updated>

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

		<entry>
		<author><name><![CDATA[awyeah]]></name></author>
		<updated>2007-08-05T20:29:23-04:00</updated>

		<published>2007-08-05T20:29:23-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=75064#p75064</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=75064#p75064"/>
		<title type="html"><![CDATA[Regexp help]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=75064#p75064"><![CDATA[
Note: You do not need to specify the <em class="text-italics">-inline switch</em> with <em class="text-italics">-all</em>. The <em class="text-italics">-all switch</em> already gives the number of possible matches.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=4875">awyeah</a> — Sun Aug 05, 2007 8:29 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[rosc2112]]></name></author>
		<updated>2007-08-05T12:06:19-04:00</updated>

		<published>2007-08-05T12:06:19-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=75032#p75032</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=75032#p75032"/>
		<title type="html"><![CDATA[Regexp help]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=75032#p75032"><![CDATA[
Once the data is in a var, you can do whatever you want with it, including putting it into an array.<br><div class="codebox"><p>Code: </p><pre><code>array set hostnames [regexp -inline -all {\[hostname\] (.*?)\n} $input]array set map [regexp -all -inline {\[map\] (.*?)\n} $input]or array set data [regexp -all -inline {\[hostname\] (.*?)\n\[map\] (.*?)\n} $input]orset count 0;set var1 "";set var2 ""foreach line {$input} {        if {[regexp {\[hostname\] (.*?)\n\[map\] (.*?)\n} $line fullmatch var1 var2]} {                  incr count                  array set myvar "$var1 $var2" "$count"         }}</code></pre></div>I use something similar to the last example in a quotes script, to count up the total lines and to pull individual matches (hence using the $count var to keep stuffing data into the array and have a running total at the same time.)<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=7395">rosc2112</a> — Sun Aug 05, 2007 12:06 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Wannabe]]></name></author>
		<updated>2007-08-05T05:53:27-04:00</updated>

		<published>2007-08-05T05:53:27-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=75010#p75010</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=75010#p75010"/>
		<title type="html"><![CDATA[Regexp help]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=75010#p75010"><![CDATA[
What i need ideally, is to read the php array into a tcl array, if i can do that, it would be perfect, only im stuggling to think of a way that isnt far beyond my tcl skills.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=7360">Wannabe</a> — Sun Aug 05, 2007 5:53 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[rosc2112]]></name></author>
		<updated>2007-08-04T22:34:12-04:00</updated>

		<published>2007-08-04T22:34:12-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=74999#p74999</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=74999#p74999"/>
		<title type="html"><![CDATA[Regexp help]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=74999#p74999"><![CDATA[
Something like:<br><div class="codebox"><p>Code: </p><pre><code>set myvar [regexp -all -inline {\[hostname\] (.*?)\n\[map\] (.*?)\n} $input]</code></pre></div>That's one way to get the data into a var, then you can use foreach or whatever you want to manipulate it. You'll prolly have to clean the data up first tho, with regsub or somn..<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=7395">rosc2112</a> — Sat Aug 04, 2007 10:34 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Wannabe]]></name></author>
		<updated>2007-08-04T14:56:59-04:00</updated>

		<published>2007-08-04T14:56:59-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=74975#p74975</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=74975#p74975"/>
		<title type="html"><![CDATA[Regexp help]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=74975#p74975"><![CDATA[
Hey guys, im struggling with a script im trying to write, i have a php script which dumps an array into a browser, and a tcl script that parses several bits of information from that array dump.<br><br>However, i now have several sections which are identical appart from the stored information im trying to retrieve, and im not sure how to get all matching results, anyone able to explain a method?<br><br>What im wanting is the information behind [hostname] and [map] from each section, the array dump is :<br> <div class="codebox"><p>Code: </p><pre><code>    Array(    [nsserver] =&gt; Array        (            [address] =&gt; 194.154.191.10:27015            [hostname] =&gt; Wireplay UK NS [Classictastic][NS + FF on]            [map] =&gt; ns_mineshaft            [gamedir] =&gt; ns            [gamename] =&gt; NS v3.2.0            [num_players] =&gt; 4            [max_players] =&gt; 16            [protocol] =&gt; 47            [server_type] =&gt; d            [server_os] =&gt; l            [password] =&gt; 0            [mod] =&gt; 1            [mod_info] =&gt; http://www.unknownworlds.com/ns/            [mod_download] =&gt; http://www.unknownworlds.com/ns/view?action=files            [mod_version] =&gt; 0            [mod_size] =&gt; -709672960            [mod_ssonly] =&gt; 9            [mod_customdll] =&gt; 0        )    [nsserver2] =&gt; Array        (            [address] =&gt; 194.154.191.11:27015            [hostname] =&gt; Wireplay UK NS [Fight Club][CO + Extralevels]            [map] =&gt; co_daimos_beta5            [gamedir] =&gt; ns            [gamename] =&gt; NS v3.2.0            [num_players] =&gt; 0            [max_players] =&gt; 18            [protocol] =&gt; 47            [server_type] =&gt; d            [server_os] =&gt; l            [password] =&gt; 0            [mod] =&gt; 1            [mod_info] =&gt; http://www.unknownworlds.com/ns/            [mod_download] =&gt; http://www.unknownworlds.com/ns/view?action=files            [mod_version] =&gt; 0            [mod_size] =&gt; -709672960            [mod_ssonly] =&gt; 9            [mod_customdll] =&gt; 0        )    [nsserver3] =&gt; Array        (            [address] =&gt; 194.154.191.12:27015            [hostname] =&gt; Wireplay UK NS [Melting Pot][CO only]            [map] =&gt; co_angst            [gamedir] =&gt; ns            [gamename] =&gt; NS v3.2.0            [num_players] =&gt; 2            [max_players] =&gt; 18            [protocol] =&gt; 47            [server_type] =&gt; d            [server_os] =&gt; l            [password] =&gt; 0            [mod] =&gt; 1            [mod_info] =&gt; http://www.unknownworlds.com/ns/            [mod_download] =&gt; http://www.unknownworlds.com/ns/view?action=files            [mod_version] =&gt; 0            [mod_size] =&gt; -709672960            [mod_ssonly] =&gt; 9            [mod_customdll] =&gt; 0        )    [nsserver4] =&gt; Array        (            [address] =&gt; 194.154.191.13:27015            [hostname] =&gt; Wireplay UK NS [Vets Surgery][NS + FF on]            [map] =&gt; ns_mineshaft            [gamedir] =&gt; ns            [gamename] =&gt; NS v3.2.0            [num_players] =&gt; 2            [max_players] =&gt; 18            [protocol] =&gt; 47            [server_type] =&gt; d            [server_os] =&gt; l            [password] =&gt; 0            [mod] =&gt; 1            [mod_info] =&gt; http://www.unknownworlds.com/ns/            [mod_download] =&gt; http://www.unknownworlds.com/ns/view?action=files            [mod_version] =&gt; 0            [mod_size] =&gt; -709672960            [mod_ssonly] =&gt; 9            [mod_customdll] =&gt; 0        )    [nsserver5] =&gt; Array        (            [address] =&gt; 194.154.191.14:27015            [hostname] =&gt; Wireplay UK NS [ProtoLab][CO + PLUGINS]            [map] =&gt; co_core            [gamedir] =&gt; ns            [gamename] =&gt; NS v3.2.0            [num_players] =&gt; 3            [max_players] =&gt; 18            [protocol] =&gt; 47            [server_type] =&gt; d            [server_os] =&gt; l            [password] =&gt; 0            [mod] =&gt; 1            [mod_info] =&gt; http://www.unknownworlds.com/ns/            [mod_download] =&gt; http://www.unknownworlds.com/ns/view?action=files            [mod_version] =&gt; 0            [mod_size] =&gt; -709672960            [mod_ssonly] =&gt; 9            [mod_customdll] =&gt; 0        ))    </code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=7360">Wannabe</a> — Sat Aug 04, 2007 2:56 pm</p><hr />
]]></content>
	</entry>
	</feed>
