Regular Expressions 101

Community Patterns

There does not seem to be anything here

Community Library Entry

1

Regular Expression
PCRE2 (PHP >=7.3)

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

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 - 21 days ago