In order to find numbers, one can use the function number().

Syntax

number([restriction_type, N1, [N2]])

This function has no required arguments. When called without arguments, the function matches all numbers.

Example

number() matches all numbers («10», «-0.2», «two», «million», etc.)

phrase(number(), "%" or percent) matches number followed by word "percent" or a percent sign ("10%", "ten percent", "-9.6%", etc.)

The arguments restriction_type, N1 and N2 are optional and are used to find numbers in a specific range. The restriction_type argument takes one of the following values:

Restriction type

Explanation

</less/lt

number is less than N1

<=/le/less or equal/less_equal

number is less than N1 or equal to N1

>/gt/greater

number is greater than N1

>=/ge/greater or equal/greater_equal

number is greater than N1 or equal to N1

=/eq/equal

number is equal to N1

!=/ne/not equal/not_equal

number is not equal to N1

()/bt/between

number belongs to the interval (N1, N2)

[]/be/between or equal/between_equal

number belongs to the interval [N1, N2]

(]/lo/left-open/left_open

number belongs to the interval (N1, N2]

[)/ro/right-open/right_open

number belongs to the interval [N1, N2)

Example

number(be, 2008, 2017) matches "2008", "2011", "2017", etc.;

char(alpha, number(">=", 10)) matches "ten", "fifty-two", "millions", etc.;

phrase(number(), "%" or percent) matches "10%", "six percent", "-9.6%", etc.

If the restriction_type consists of mathematical symbols, they should be enclosed in quotes (">", "()", "!=", etc.).

If the restriction_type consists of two or more words or contains a hyphen, it should also be enclosed in quotes ("not equal", "between or equal", "right-open").

The negative value of an argument should also be enclosed in quotes:

number(less, "-3") matches «-3.3», «-50», «minus 14.5», etc.

The function also supports an optional named parameter allow_multiword. If the option is enabled, numbers written in more than one words (two hundred, one million) are treated as a single unit and correctly converted into a numerical value. Using this option may result in performance loss. By default, allow_multiword:=no.

Example

number(greater_equal, 79) matches "141" and "79" in "Sabanci is buying 12 percent of the unit from Carrefour of France for 141 million liras ($79 million)".

number(greater_equal, 79, allow_multiword:=yes) matches "141 million" and "79 million" in "Sabanci is buying 12 percent of the unit from Carrefour of France for 141 million liras ($79 million)", because numbers are treated as a single unit when the option allow_multiword is on.

In order to find numbers written in words, digits or numerals, one can use the optional named parameter type that takes one of the following values:

Value

Explanation

numeral

numbers consisting of digits and symbols, permitted to use within numbers (e.g., dots, slashes etc.)

digit

numbers consisting of digits only, without any symbols, permitted to use within numbers

word

numbers written in words

any

numbers written in both words and digits

Several types to search may be specified by a vertical bar ("|") character, e.g. type:=digit|word.

Example

number(greater, 2, type:=word) matches "two", "three", "four", etc.

number(greater, 100, type:=word, allow_multiword:=yes) matches "two hundred", "three million", "million", etc.

number(greater, 2, type:=digit) matches "4", "5, etc.

number(greater, 2, type:=numeral) matches "2.3", "5,5", "3", etc.

number(greater, 2, type:=any) matches "three", "3", "2.3", etc.

number(greater, 2, type:=digit|word) matches "three", "3", "4", "four", etc.

Note

The function number() matches numbers written both in digits and in words.

In order to find only numbers written in digits, users can also use the query char(numeral, number()) or char(digit, number()).

In order to find only numbers written in words, users can use the query char(alpha, number()).

Learn more about the function char() at Punctuation and Special Symbols Search.