Hello all,

I've played a bit with the regular expressions in TB, and... well, 
if someone is interested, here's just an interesting task:

Assume you want to get rid of those funny 
"XYZ>" quotation marks (I really dislike these:-)). Well, if you 
don't want to get rid of these, it doesn't really matter:-). At first I 
thought it would be quite a simple task to do so using 
%REGEXPTEXT and %REGEXPQUOTES macros, but... Well, 
first things first: let's consider the simpliest possible case, the 
message looking like:

some text...
some text...

XYZ> some text...
XYZ> some text...

XYZ> some text...

So here we are, the task would be to construct the Reply 
Template that would automatically get rid of "ZYZ>" things, 
replacing them with just ">" or whatever. In Perl, this task is not 
a task at all, for example, assuming that I have the message text 
in the variable $kisa, I would write something like:

@words=$kisa =~/(?-sm)>.*\n/g; 
print "@words\n";

or maybe I would have made the output operator look 
somewhat different; anyhow, it doesn't matter:-) What matters 
here is of course the first line which with the help of regular 
expressions AND the /g modifier (which forces Perl to match 
globally) does the whole dirty work... Naturally, this script might 
be generalized for the general case when one deals with the 
quotation marks of the form: ">>>XYZ>>VTN>>" etc., it's not a 
problem to do so (maybe, couple of minutes at most)...

So at first I thought it would be just as simple as that to 
implement somewhat similar in terms of TB regular expressions, 
but... To begin with, TB doesn't allow one to match globally:-(( 
So, has anybody some idea how to do the trick without global 
search? 

If there exists no such possibility, here's a wishlist item #1:

1. Add the Global match modifier, please!

Note that the proposed functionality might prove to be quite 
useful for a wide range of tasks. I could probably expand this 
thought further and prove the point, but I'm leaving it up to you:-)

Now let's go further in our discussion of regular expressions 
and what one might do with them:-)... Suppose I do something 
with, say, %HEADERS string (i.e., manipulate it using regular 
expressions). The most obvious task would be correcting that 
odd TB's mistake when it puts the *localized* message creation 
date as the result of %ODATE macro. It's of course quite 
simple to do the trick, but then one would need to update each 
and every template correspondingly. This would be greatly 
simplified if one could *define* _new_ macros this way:

%MYODATE="(the sequence of templates defining the new   
                                one)"
 
Apparently, currently one hasn't such functionality available. So 
the wishlist item #2 is:

2. Implement the possibility to define new templates based on 
the existing ones, please!

Obviously, these user-defined templates need to be system-
wide and there needs to be some place where their definitions 
are to be stored (and edited by the user), for example, this 
could be a new page in Account Preferences or any other:-)

**********

Okay, this message proved to be rather long one, but anyhow, 
what do you think? 

-- 
SY, Alex
(St.Petersburg, Russia)
http://mph.phys.spbu.ru/~akiselev
--- 
Thought for the day:
  If the probability of success is not almost one, then it is
  damned near zero.

--- 
PGP public keys on keyservers:
0xA2194BF9 (RSA);   0x214135A2 (DH/DSS)
fingerprints:
F222 4AEF EC9F 5FA6  7515 910A 2429 9CB1 (RSA)
A677 81C9 48CF 16D1 B589  9D33 E7D5 675F 2141 35A2 (DH/DSS) 
--- 

-- 
--------------------------------------------------------------
View the TBUDL archive at http://tbudl.thebat.dutaint.com
To send a message to the list moderation team double click here:
   <mailto:[EMAIL PROTECTED]>
To Unsubscribe from TBUDL, double click here and send the message:
   <mailto:[EMAIL PROTECTED]>
--------------------------------------------------------------

Reply via email to