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
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
I think the problem is some confusion about the definition of the quantifiers.
|
Beta Was this translation helpful? Give feedback.
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 wordfake
rather than the whole text. If you only want matches that cover the whole text, you'll have to filter the matches (theon_match
callback is an easy place to do this).