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

	<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>2004-02-29T14:56:07-04:00</updated>

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

		<entry>
		<author><name><![CDATA[Anonymous]]></name></author>
		<updated>2004-02-29T14:56:07-04:00</updated>

		<published>2004-02-29T14:56:07-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=34114#p34114</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=34114#p34114"/>
		<title type="html"><![CDATA[regexp/regular expressions]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=34114#p34114"><![CDATA[
Ah, thanks. That did the trick. And when saying 'regexp' I refered to 'regular expressions' - I knew what I needed was regsub.  <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_mrgreen.gif" width="15" height="15" alt=":mrgreen:" title="Mr. Green"><p>Statistics: Posted by Guest — Sun Feb 29, 2004 2:56 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[strikelight]]></name></author>
		<updated>2004-02-29T12:48:08-04:00</updated>

		<published>2004-02-29T12:48:08-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=34111#p34111</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=34111#p34111"/>
		<title type="html"><![CDATA[Using regexp to insert commas into date string]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=34111#p34111"><![CDATA[
You are correct in saying regular expressions, however incorrect in wanting to use "regexp" for the task.  You will want to use regsub for the job using regular expressions...<br><br>ie.<div class="codebox"><p>Code: </p><pre><code>regsub -all {([^0-9]) } $text {\1, } text</code></pre></div>The "([^0-9]) " matches any non-numeric character before a space,<br>the \1 says you still want that character but place a comma and space after it....<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2005">strikelight</a> — Sun Feb 29, 2004 12:48 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Anonymous]]></name></author>
		<updated>2004-02-29T11:08:15-04:00</updated>

		<published>2004-02-29T11:08:15-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=34110#p34110</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=34110#p34110"/>
		<title type="html"><![CDATA[Using regexp to insert commas into date string]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=34110#p34110"><![CDATA[
Let's assume I have a variable called 'time' whose value is '63 days 4 hours 28 minutes' and I want to insert a comma after every word without a preceding number. I wrote a small procedure to do the trick, but it is messy and rather cpu intensive, so I figured I'd use regular expressions instead. My problem is, despite hours of studying various regexp- manuals and tutorials, that I can't figure out how. This is how I want the string to look after formatting it: "63 days, 4 hours, 28 minutes"<br><br>The procedure, which simply scans through the string given, checks if the previous character was not a number and if the current character is an empty space, inserts a comma, looks like this:<br><div class="codebox"><p>Code: </p><pre><code>proc fixtime {time} {   set p ""   set r ""   foreach c [split $time ""] {      if {![string is integer $p] &amp;&amp; [string equal " " $c]} {         append r ,      }      append r $c      set p $c   }   return $r}</code></pre></div>So, does anyone a little more experienced using regular expressions know how I could go on about this? If so, I'd appreciate it if you would share your knowledge with me. I've spent too many hours trying and failing to do anything else. Thanks in advance.<p>Statistics: Posted by Guest — Sun Feb 29, 2004 11:08 am</p><hr />
]]></content>
	</entry>
	</feed>
