Repository navigation
Does not match non-negated prhases, with "+", "?" or "!" operator as first token #5538
|
I am trying to match a short phrase where the token is not negated. So I am trying to put the negation as an optional token at the beginning of the matcher. How to reproduce the behaviourpattern_o = Result(for o1): pattern_o2 = Result (for o2 and o3): Your Environment
|
Replies: 1 comment
|
I think the problem is some confusion about the definition of the quantifiers.
|
I think the problem is some confusion about the definition of the quantifiers.
!in particular can cause some confusion and I think the docs could be improved a bit here.{"OP": "!"}matches exactly one negated token and won't match if no token is present in that position in the pattern. It can't be used to match 0 tokens.{"OP": "?"}can match 0 or 1 tokens, so you're see some matches on part of the text, like just the wordfakerather than the whole text. If you only want matches that cover the whole text, you'll have to filter the matches (theon_matchcallback is an easy place to do this).