RE negation is non-intuitive
but I believe the implementation is correct
the non-intuitive part is this:
then negation of (123)! is *all* substrings that do not match 123
e.g., 12 matches (123)!

the reason is that RE+negation must be closed under its operations
the closure of a negation can be a large space for some patterns

to see what is going on express your tests as testregex test cases
I'll start you off with the following "negation.dat"
we can expand it on the list here and then I'll put it in a future release

be sure to preserve the <TAB>s
and run like this
        testregex negation.dat

---
: X/Open regex negation tests 2010-03-01

A       (123)!          123                     (0,2)
K       !(123)          123                     (0,2)(0,2)

A       (...)&(123)!    123                     NOMATCH
K       @(???)&(!(123)) 123                     NOMATCH

A       (12)!           123                     (0,3)
K       !(12)           123                     (0,3)(0,3)

_______________________________________________
ast-users mailing list
[email protected]
https://mailman.research.att.com/mailman/listinfo/ast-users

Reply via email to