Skip to main content

MX_RECORD_PATTERN

Constant MX_RECORD_PATTERN 

Source
pub const MX_RECORD_PATTERN: &str = r"^(0|[1-9][0-9]{0,3}|[1-5][0-9]{4}|6[0-4][0-9]{3}|65[0-4][0-9]{2}|655[0-2][0-9]|6553[0-5])\s\S+$";
Expand description

Regex for a Route53 MX record value: a preference 0–65535, a single whitespace, then the mail-exchange host. The bounded-preference alternation enforces the 16-bit range (an unbounded \d+ would wrongly accept 70000), and the single \s rejects the double-space form the service rejects.