Hello Silviu,
Historians believe that Friday, September 14, 2001 at 03:45 GMT +0300
was when, Silviu Cojocaru [SC] typed the following:
SC> this about "subject without Re: or Fw(d):"
SC> The regexp I cooked for this looks something like this:
SC> ^(R[Ee]: ?|F[Wv]d?: ?)(.*)$
SC> Now how do I make my templates do this ?
There are several macros that you can use. I'll give you the most
flexible one, but check out the help file for other options. Marck
has made them very easy to find.
Tell TB what pattern to use with:
%SETPATTREGEXP="<pattern>"
Tell TB what string to examine:
%REGEXPBLINDMATCH="<some text>"
Note, the text in this is really a mini-template, so you can include
any macros (eg %OSUBJ) to generate the text.
Tell TB what part of the match you want to use:
%SUBPATT="<subpattern number>"
The entire match is stored in Subpattern 0. The subpatterns are
counted by the number of opening brackets "(" of capturing
subpatterns. In your example above, you have 2 subpatterns. The one
you want is subpattern 2.
Speaking of your example, your regexp is good, but will probably cause
some problems. Since you're trying to learn this on your own, I'll
just make some general comments and let you figure out how they apply
to your regexp.
1. You can make searches case-insensitive by adding the string "(?i)"
to the beginning of your regexp.
2. Spaces are meaningful in most TB regexps unless you set the
extended regular expression option. I have not tested this mode,
so I'd be careful. If you want to include whitespace in your
searches, use the meta-character "\s". Note, that is a lowercase
s, an uppercase S has the opposite meaning.
3. To apply a repeat operator to more than one character, you must
enclose the sub-string in brackets and put the repeat character
outside. You can make the subpattern non-capturing, but I'll let
you look into the Help file for details.
4. You can make an OR statement using the construction: "(<s1>|<s2>)".
Change <s1> and <s2> for the appropriate strings.
5. You might want to consider the case of "Re[3]:" for TB users.
BTW, I know there are macros out there that do the job you're trying
to do. For example, look at Jan Rifkinson's messages. If you get
stuck, perhaps Jan can post the version he is using.
--
Thanks for writing,
Januk Aggarwal
Using The Bat! 1.54 Beta/8 under Windows 98 4.10 Build 2222 A
OK, I'm weird! But I'm saving up to become eccentric.
--
______________________________________________________
Archives : http://tbtech.thebat.dutaint.com
Moderators : mailto:[EMAIL PROTECTED]
Unsubscribe: mailto:[EMAIL PROTECTED]