ietf-mta-filters
[Top] [All Lists]

Re: Stripping leading/trailing spaces in relational draft

2005-10-05 07:26:16

On Wed, 2005-10-05 at 14:26 +0200, Michael Haardt wrote:
There is still the yet unanswered question if leading or trailing white
space on the right side is an error, as it could never be matched by
any argument on the left side and is likely a mistake.

you're assuming only "eq" or "ne".  for "lt" the trailing whitespace
will be significant.  also, there are many other tests which will never
match, e.g.

   if address :is "From" "illegal(_dot_)(_dot_)address(_at_)example(_dot_)com"

while some implementation may choose to look for and report such errors
(during upload), I don't think we need to get into details of this sort.

thanks for the note, though, because the text I just suggested for
variables is wrong!  here's a fixed version:


   Note: The "relational" extension also adds a match type called
   ":value".  This match type strips leading and trailing whitespace in
   the source string (or string list) prior to comparison.  If it is
   desired to make whitespace significant, this can be accomplished by
   prefixing and suffixing every value with an arbitrary non-whitespace
   character.

   Example:
      require "relational";
      set "empty" "";
      set "spaces" "      ";
      if string :value "eq" "${spaces}" "${empty}" {
          # the above test succeeds
      }
      if string :value "ne" "X${spaces}X" "X${empty}X" {
          # the above test succeeds
      }


-- 
Kjetil T.