procmail
[Top] [All Lists]

Re: matching high5 chars

2001-09-21 06:27:31
Dallman Ross posted this assignment (where $TAB and $SPACE had previously
been defined as single-character strings of the respective character),

R>   NONPRINTING = [^$TAB$SPACE-~] # char delimiter to i.d. non-Western text

Odhiambo Washington wondered (as quoted by Martin Mokrejs: Odhiambo's posts
are always attachments, so I don't see them),

W> I was just wondering what the right order is: TAB-SPACE or SPACE-TAB ??

Martin responded incorrectly,

M> Does not matter, you are putting into square braces [] a list of
M> characters, and the list has no order.

It's not a list: it's a list plus a range, and ranges do have order.  This
will be easier to understand if you are familiar with ASCII codes or are
looking at a table of them.  These are the codes that matter for this post:

tab = 9
space = 32
exclamation point = 33
tilde = 126

If the tab and the space were the only characters between the braces, the
class would be a list and Martin's comment would apply, but they aren't.
Rather the class, before inversion by the leading caret, consists of a tab
plus the RANGE from space through tilde.  Putting the space first would
change the add a considerable number of non-printing characters to the range
(all that lie between tab and space) and thus [because the class is
inverted] exclude them from the class, and we want all of them in there
except tab and space.

If the class were specified this way (note the exclamation point):

 [$TAB$SPACE!-~]

then the two would be transposable, and

 [$SPACE$TAB!-~]

would be the same.  By putting the tab first, one can drop the exclamation
point.

When there is no range involved but just a listing of characters, then the
order -- at least of space and tab -- doesn't matter.  It's customary to put
the space first then but there's no difference in operation.



_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

<Prev in Thread] Current Thread [Next in Thread>