Skip to content

PREV NOT operator

A combination of two expressions made with the PREV 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 preceding sentences within the scope of the rule.
The PREV 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.
PREV NOT can be used to extend the reach of positional sequences, which have a single-sentence scope.

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

TEMPLATE(PERSONAL_DATA)
{
    @BIRTH_DATE
}

...

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

The rule's condition matches a date (TYPE(DAT)) if no occurrence of a person's name (TYPE(NPH)) is found in all the other preceding 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 date (10/21/1976) is preceded by a name (Tom Smith) two sentences before. If the scope of the rule is reduces to two consecutive sentences:

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

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

Template: PERSONAL_DATA

Field Value
@BIRTH_DATE Oct-21-1976

The syntax is:

expression
PREV NOT
expression

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


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