FAQ about patches | More patches | Main Page | SHA256 digest for this patch

Add Regular Expressions Support to Alpine
Patch is available for version: alpine 0.9999
 
This patch adds limited support for regular expression to Alpine. It is intended to extend that support over time, and as this is done, this information will be expanded and updated. This patch can only be used in conjunction with other patches. Installed on its own, this patch will not do anything, but for example it can be used together with the colortext patch to paint special text in special colors, or the rules patch to match strings that should be deleted from a subject.

In a regular expression every character matches itself. Except by a few characters that have special meaning. The list of special characters that this feature supports is "[ ] * . \". In order to write each of these characters, you must preceed it with a backslash chraracter. See the examples below.

The global matching character is the "*" character. It matches the character that preceeds it, for example "A*" matches the letter "A". What makes the global matching character special is that it matches any number of repetitions of that character (including zero repetitions). Therefore, "A*" matches "A" and "AAAA".

The "." character matches any character.

A group of characters enclosed by betwen "[" and "]" matches only one of the characters enclosed in that group. For example "[Pp]" matches either the uppercase or lowercase letter "P".

Here are a few example
PatternMatchesDoes not Match
ABCABcab
e*dseedpeet
[AO][NR]ONOX
[AO][NR]*EANNERE
A.EACEANTE
\[.*\][alpine-alpha]alpine-alpha

Last Updated 22:22:11 PDT Thu Oct 11 2007.