Community Patterns

Community Library Entry

1

Regular Expression
Created·2025-10-06 13:10
Flavor·PCRE2 (PHP)

/
([\*a-zA-Z\.0-9\-_]*)[ \t]*([0-9]*)[ \t]*IN[ \t]([A-Z0-9]*)[ \t]*(.*)\n
/
gm
Open regex in editor

Description

There are 4 capture groups: 1: domain name 2: TTL (how long until the record expires) 3: TYPE (the type of DNS record) 4: CONTENT (the content of the DNS record. This depends on the type)

Make sure every line ends with a \n, otherwise the regex will not find the last entry! This regex should be capable of reading every type of DNS record, including NSEC3- and RRSIG-type records.

Submitted by Thomdestreamer