Previous Topic: Basic Rules

Next Topic: Policy Tuning Ignoring Key Words or Phrases When They Occur in Disclaimers

Matching Numbers

You can match specific numbers exactly, for example, 100, 1506, 867-5309 ('literal matching') or you can match against a template (for example, 'match any 5-digit number joined by a hyphen to a 4-digit number').

Syntax

Templates only: %# ... %

This syntax is mandatory when specifying a character template or number template. It matches the contained template on a per character basis.

Separate multiple templates with commas:

%#<template>%,%#<template>%

This syntax is not needed for literal matching.

\a or \A

Matches any single letter

\d or \D

Matches any single digit (0-9)

\l or \L

Matches any single letter or digit

\p or \P

Matches any single punctuation character

[M]

Matches a character M times. For example, \d[3] matches any 3 digit number.

[M,N]

Matches a character from M to N times. For example, \d[1,5] matches any number with between 1 and 5 digits

[[a-z]]

Matches any character between 'a' and 'z'. Use this syntax to limit the range of permitted character matches.

Examples

867-5309

Captures 867-5309 only; it does not capture, for example, 5309, or 467-5309.

%#\d[5]\a[3]-\d[5,7]%

Captures any string of 5 digits followed by 3 letters, followed by a hyphen and 5 to 7 digits. For example, 32456dfs-345661.

%#\d[3]{.|-| }\d[4]%

Captures 7 digit telephone numbers where the first three digits are separated by a period, a dash, or a space. For example, 021-7657 or 021 7657.

%#[[2-5]]\d[11,13]%

Captures any numeric string that starts with 2, 3, 4, or 5, and is followed by 11 to 13 digits. For example, 398744614630.

%#22\a[2]\d[1,4]\p [[x-z]]%

Captures the number 22, followed by exactly two letters, then 1 to 4 digits, joined to punctuation, then followed by a space and the letter x, y, or z. For example, 22AB123. Z.