before

Purpose

Finds a text fragment from the beginning of the document till the argument.

Syntax

before(argument)

Arguments

The function accepts single argument.

The function also accepts the following optional named parameters:

  • scope:=text/line/sentence/paragraph limits the search to a fragment from the beginning of a text/line/sentence/paragraph. By default, scope:=text.

  • endpoint:=yes/no includes the argument in the result or excludes it. By default, endpoint:=no, i.e. the argument is excluded from the result.

  • allow_punct:=yes/no allows or prohibits punctuation between arguments (set to "no" by default).

  • trim_punct:=yes/no/left/right removes or leaves punctuation at the beginning or at the end of the interval (set to "yes" by default).

trim_punct:=no does not remove punctuation.

trim_punct:=left removes punctuation at the beginning of the interval.

trim_punct:=right removes punctuation at the end of the interval.

  • match:=first/last/shortest/longest matches the first/last/shortest/longest result.

The match parameter can be combined with scope:=sentence/text/paragraph/line:

  • match:=shortest, scope:=sentence matches the shortest result within a sentence.

  • match:=last, scope:=paragraph matches the last result within a paragraph.

  • match:=first, scope:=text matches the first result within a text.

Returned Value

Documents matching the query.

Examples

before(":", scope:=sentence) matches "Product event summary" in the sentence "Product event summary: the device was returned and analyzed".

before(2000, scope:=line, endpoint:=yes) matches "November 23" in the line "November 23, 2000".

before(wire, scope:=sentence, trim_punct:=yes) = before(wire, scope:=sentence) matches "Photo: Business" in the sentence "(Photo: Business Wire)".

before(wire, scope:=sentence, trim_punct:=no) matches "(Photo: Business" in the sentence "(Photo: Business Wire)".

before(photo, scope:=sentence, trim_punct:=left) matches "Photo" in the sentence "(Photo: Business Wire)".

before(photo, scope:=sentence, trim_punct:=right) matches "(Photo" in the sentence "(Photo: Business Wire)".