Hello, Task. 
You wrote in <mid:[EMAIL PROTECTED]>

TC> and I don't undertand: "what are you thinking men" please, explain
TC> you.
TC> first question: what is a regular expression.

Well, the simplest example: you can see my letter-prefix:
"You wrote in <mid:[EMAIL PROTECTED]>". This is
generated automatically by template using regular expression. Any
letter contain ID as "<[EMAIL PROTECTED]>". You
need to insert the "mid:"; into the angle brackets. It realized by just
one line in the "answer" template:

%SetPattRegExp="\<(.*)\>" You wrote in <mid:%RegExpMatch="%OMSGID";>

The pattern for regular expression is "\<(.*)\>". The first "\<" and
the last "\>" simple mean "<" and ">". Phrase in parentheses "(.*)"
means the very subsrting which will be returned as a result. Inside
the phrase: "." called 'atom' and means "any symbol", "*" called
'quantifier', is attached to "." and means "previous atom any times",
so ".*" means "some symbols". By applying this whole regexp pattern to
a string enclosed in angle brackets, like
'<[EMAIL PROTECTED]>' you'll get the string
without brackets, ie. '[EMAIL PROTECTED]'
because the brackets in the pattern are outside the parentheses. So
the macros defines the pattern '\<(.*)\>' by %SetPattRegExp, then
applies it to message ID by %RegExpMatch='%OMSGID' and then places the
result between "You wrote in <mid:"; and ">".


...just few more examples:

...if you have to find 'elephant' in a letter, you just need to define
appropriate pattern for recognizing by it different variants (let me
treat non-empty result as 'true' and empty string as 'false')

'\belephant\b'        FALSE for 'my elephant red' and TRUE for 'telephantom'
'\Belephant\B'        TRUE for 'my elephant red' and FALSE for 'telephantom'
'\W(elephant)\W'  TRUE for '$elephant#' and FALSE for '3elephants', 's elephant df'
'e\s+l\s+e\s+p\s+h\s+a\s+n\s+t' (the \s+ between every letters)
                  TRUE for 'elephant' and 'e l e ph   a nt'
'(?s)e\.?l\.?e\.?p\.?h\.?a\.?n\.?t' (the \.? between every letters)
                  TRUE for 'elephant', 'e.l.e.p.h.a.n.t' and
'e
l
p
h
a
n
t'

So, if you need to filter any specific variant you mus just construct
the regexp from your signal word by adding to it prefix and/or suffix
and (if necessary) by inserting something between letters.

That us take a line for search, for example our 'elephant'. We can
test a text for the line by two steps:

1. Construct a regexp pattern from signal line:

- for 'partial search' - leave the line:
      'elephant' --> 'elephant' (no change)
      
- for 'wholeword search', add '\b' before and after line;
      'elephant' --> '\belephant\b'
      
- for 'space-delimited search', add '\s+' between letters
      'elephant' --> 'e\s+l\s+e\s+p\s+h\s+a\s+n\s+t'

- for any other phantasy - just learn how to make appropriate regexp.

2. Just apply constructed pattern to a target text by calling
pcre.dll. That's all!



TC> we can make a plug'in that call a dll, and use the dll in the bat!

I meant that The Bat! is already uses regular expressions! And if I
understand clear, it uses the same pcre.dll, but it is statically
linked into TheBat.exe (I think that Stefan Tanurkov knows it better :)
My point was if Tha Bat! developers make the library accessible for
sharing then it would not be necessary for 'outsiders' to deploy an
extra copy of the library with their plugins.


-- 
Sincerely,
 Alexey.
Using TB 1.63b7 on WinXP SP1 Corp + MUI RU, spelling by ORFO2002
   mailto:[EMAIL PROTECTED]


________________________________________________
Current version is 1.62 | "Using TBDEV" information:
http://www.silverstones.com/thebat/TBUDLInfo.html

Reply via email to