Why no RE match of A AND B?
Anders J. Munch
andersjm at dancontrol.dk
Wed Mar 5 06:13:40 EST 2003
"Tim Peters" <tim.one at comcast.net> wrote:
> [Anders J. Munch]
> > It's [regexp intersection] useful in combination with complement ("it's
> > a .*day but not a Sunday").
>
> If that's the use case, it's more an argument for adding a difference
> operator (like R-S = the strings matched by R less the strings matched by
> S).
That might be so. Not that I'm proposing to add anything of either
kind.
It's easier though to express difference through intersection and
complement
R-S = R & ~S
than the other way around
R & S = (R|S) - (R-S) - (S-R)
- Anders
More information about the Python-list
mailing list