Regular Expressions 101

Community Patterns

Detect DNS Zones with Authoritative Nameservers

-2

Regular Expression
PCRE (PHP <7.3)

/
^([\w.]+\.)\s+.+\sNS\s.+\1
/

Description

This can be used to find all zone files that contain authoritative nameservers - e.g.

perl -ne 'print if /^([\w.]+.)\s+.+\sNS\s.+\1/' /var/named/*.db | awk '{print $1}' | sort | uniq

Submitted by Santrix - 9 years ago