01.02 – Regular Expressions in TB! (engl.)

  1. Home
  2. /
  3. 01 – Reguläre Ausdrücke
  4. /
  5. 01.02 – Regular Expressions...

Regex (TB): 1. Introduction

Whenever I came across something interesting in a mail that was created with TheBat! like „cleaned“ Subject-strings or automagically deleted PGP-lines, I would ask in one of the mailing lists: „How did you do that?“. Quite often I would receive a reply like „You will need a regex for that!“ And sometimes the result was something like:

%QUOTES="%SETPATTREGEXP=""(?is)
(-----BEGIN PGP SIGNED.*?\n(Hash:.*?\n)?\s*)?(.*?)
(^(- --|--\n|-----BEGIN PGP SIGNATURE)|\z)""
%REGEXPBLINDMATCH=""%text""%SUBPATT=""3"""

This is only a simple example of those cryptic looking combinations of TB!-Macros and regular expressions which are simply called „regex“ by the TB-experts. To me it seemed a random sequence of characters; as if a cat walked across my keyboard. Awkward, arbitrary and cryptic, that at least was my impression until Januk Aggarwal (special thanks to him) gave me a short introduction to regex at TBTECH and my workmate Alfred Rübartsch gave me a copy of Jeffrey Friedls excellent book „Mastering Regular Expressions“.

Although I entered the fascinating world of Regular Expression with the help of these two, I am still not an expert in the „regexian“ language. Anyway, as an advanced beginner, I have dared to write this tutorial to hopefully explain some things and give a good start in „Regular Expressions“ to other beginners.

This tutorial is meant to bring you into closer contact with the regex topic. Well, let’s see how it works; let’s see whether we will be able to explain the „regex“-example above by the time we come to the end of this tutorial.

next