From <@jota.sm.luth.se:hawkeye@glia.biostr.washington.edu> Thu Mar 31 00:20:29 1994
Received: from jota.sm.luth.se (jota.sm.luth.se [130.240.2.4]) by mother.ludd.luth.se (8.6.8/8.6.6) with SMTP id AAA20028 for <unicorn@ludd.luth.se>; Thu, 31 Mar 1994 00:20:27 +0200
Received: from my.sm.luth.se by jota.sm.luth.se with SMTP
	(5.67a8/IDA-1.2.8-NS) id AA09075; Thu, 31 Mar 1994 00:20:42 +0200
Received: from mailhost1.cac.washington.edu by my.sm.luth.se with SMTP
	(5.67a8/IDA-1.2.8-NS) id AA24890; Thu, 31 Mar 1994 00:20:15 +0200
Received: from glia.biostr.washington.edu by mailhost1.cac.washington.edu
	(5.65+UW94.3/UW-NDC Revision: 2.30 ) id AA11652;
	Wed, 30 Mar 94 14:20:10 -0800
From: hawkeye@glia.biostr.washington.edu (Ken Keys)
Posted-Date: Wed, 30 Mar 94 14:31:33 PST
Message-Id: <9403302231.AA11199@glia.biostr.washington.edu>
Received: by glia.biostr.washington.edu
  (911016.SGI/Eno-0.1) id AA11199; Wed, 30 Mar 94 14:31:33 -0800
Subject: Re: TinyFugue Mosaic Caller
To: d88-kss@sm.luth.se
Date: Wed, 30 Mar 94 14:31:33 PST
In-Reply-To: <199403301225.AA02799@jota41.sm.luth.se>; from "d88-kss@sm.luth.se" at Mar 30, 94 2:25 pm
X-Mailer: ELM [version 2.3 PL11]
Status: RO

> 
> Greetings Ken,
> 
> My name is K}re Synnes and study computer science at a university in Sweden. I am an
> administrator for a mud called Midnight Sun, and am currently working on a linkage
> package towards Mosaico anf the html+ standard.
> 
> What I want to do it this:
> 
> 0/ A string is echoed from the mud.
> 
> 1/ Filter out strings like <http ...> from the mud.
> 
> 2/ Echo everything but what was filtered out.
> 
> 3/ Send the filtered string to a UNIX script.
> 
> This could look like this:
> 
> 0/ A green flower <http ...> that smells marvellously.
> 
> 1/ Filter out: <http ...>
> 
> 2/ Echo : A green flower that smells marvellously.
> 
> 3/ Call script with : "http ..."
> 
> Is this possible to do with tinyfugue? If so, could you tell me how?

It's fairly easy to do with the new /substitute command, added in version
3.3 alpha 6 (available at glia.biostr.washington.edu:pub/tinyfugue).
Something like this:

/def -p99999 -F -mglob -t"*<http*>*" http_filter = \
    /let line=%*%;\
    /test regmatch("^(.*)<http(.*)>(.*)$$", line)%;\
    /substitute %{P1}%{P3}%;\
    /quote -0 /echo !http %{P2}

This example only works on one <http...> per line; if it's posible to have
more than one, you'd have to loop while regmatch was true, and replace
"line" with the unexamined portion each time.

I could have just used "^(.*)<http(.*)>(.*)$" in the trigger, but it's
much slower (the leading ".*" is very expensive).  And putting it in
regmatch() makes it easier to generalize to multiple occurances per
line.

-- 
Ken "Hawkeye" Keys                  |  If you use TinyFugue, help support it.
hawkeye@glia.biostr.washington.edu  |  Send donations to:  Ken Keys
------------------------------------+-------------------+  1820 Cottonwood Av.
TinyFugue 3.3 alpha 6: ftp glia.biostr.washington.edu   |  Carlsbad CA 92009


