Share via


2.2.5 ABF_NORMALIZATION_RULES Structure


0


1


2


3


4


5


6


7


8


9

1
0


1


2


3


4


5


6


7


8


9

2
0


1


2


3


4


5


6


7


8


9

3
0


1

Length

Rules (variable)

...

Length (4 bytes): A 32-bit unsigned number that is the number of bytes in the Rules field.

Rules (variable): A series of UTF-8 characters that contains phone number normalization rules. The number of characters in the series is specified by the Length field. If Length is nonzero, the last byte of the Rules field MUST be a zero byte. Each rule consists of two lines, and each line MUST be terminated by a carriage return, linefeed sequence (0xD, 0xA). The first line is a regular expression to match against a phone number string, using standard [MC-RegEx] regular expression syntax.<8> The second line is a replacement string to convert the matching phone number into a valid [E164] number. When more than one rule is present, the rules MUST be processed in order, and the phone number is normalized using the first matching rule. If no rule matches a phone number, the phone number is not normalized.

There is a special built-in rule called E164. If the regular expression in the first line of one of the preceding pairs of lines is the string "E164," the second line is ignored and the rule matches any input that consists of 15 or fewer decimal digits, with any spaces, periods, hyphens, or parentheses ignored. If an input does match the built-in E164 rule, the result is "tel:+" followed by the digits that matched. The ignored characters are discarded.