Skip to content

NEXT NOT operator

A combination of two expressions made with the NEXT NOT operator is true if the expression before the operator is matched in a sentence and the expression after it is not matched in all the subsequent sentences within the scope of the rule.
The NEXT NOT operator then requires the scope of the rule to be at least two consecutive sentences, such as SENTENCE*# with # > 1 or PARAGRAPH1, the rule is not complied if a different scope is used.
NEXT NOT can be used to extend the reach of positional sequences, which have a single-sentence scope.

As an example of the use of NEXT NOT, consider this:

TEMPLATE(PERSONAL_DATA)
{
    @NAME
}

...

SCOPE SENTENCE*3
{
    IDENTIFY(PERSONAL_DATA)
    {
        @NAME[TYPE(NPH)]
        NEXT NOT
        TYPE(DAT)
    }
}

The rule's condition matches a person's name (TYPE(NPH)) in a sentence if a date (TYPE(DAT)) is not found in all the subsequent sentences within the rule's scope (three sentences).

If the rule is run against this text:

Personal Data
------------
Name: Tom Smith
Phone number: 123 456 7890
Date of birth: 10/21/1976

the rule is not triggered, because the name (Tom Smith) is followed, two sentences after, by a date (10/21/1976). If the scope of the rule is reduces to two consecutive sentences:

SCOPE SENTENCE*2
{
    IDENTIFY(PERSONAL_DATA)
    {
        @NAME[TYPE(NPH)]
        NEXT NOT
        TYPE(DAT)
    }
}

and the rule is run against the same text, it is triggered and this record gets extracted:

Template: PERSONAL_DATA

Field Value
@NAME Tom Smith

The syntax is:

expression
NEXT NOT
expression

where NEXT NOT are language keywords and must be written in uppercase.


  1. If a paragraph consists of only one sentence, the combination will be false.