[Raw Msg Headers][Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Regex in sift statements
Felix Lee wrote:
> > > The following regex behaves in a way that reveals my ignorance of
> > > regexes.
> > > (.*)::([A-Z]*)
> > > This will match on CAN:: and CANEDM::Q but fails for CANEDM::QQ
>
> I think it's a side effect of the token-matching semantics of sift.
> [A-Z] matches a 1-char token, not a char within a token.
>
> personally, I think the token-matching semantics was a bad idea. It's
> not quite flexible enough and it's easy to make mistakes. I'd prefer
> normal regexps augmented with metachars that match whole tokens.
Ok, I have now coded string-sift in addition to the present
token-sift. The stuff is mostly that of mr. Thomas Knott,
but not quite, because I preserved the old stuff in there.
To minimize the impact on the scripts the new "SIFT" is known
with name "SSIFT", and the old one is still the "SIFT"..
I think better would be to call them "SIFT" (string-Sift),
and "TSIFT" (token-Sift), but it would mean a serious rewrite
on the config scripts...
Or perhaps they should be called "SSIFT" and "TSIFT", so that
nobody would fall on a trap when things change ?
Comments ? (... before I make the dump with them ...)
> --
/Matti Aarnio <mea@nic.funet.fi>