named.conf
options {
listen-on port 53 { 127.0.0.1;};
listen-on-v6 port 53 { ::1; };
directory "/var/named";
dump-file "/var/named/data/cache_dump.db";
statistics-file "/var/named/data/named_stats.txt";
memstatistics-file "/var/named/data/named_mem_stats.txt";
};
view lan {
match-clients {localhost;};
zone "home.com" IN {
type master;
file "home.zone";
};
zone "test.com" IN {
type master;
file "test.com.zone";
};
zone "demo.local" IN {
type master;
file "f.demo.local";
allow-update { none; };
};
zone "1.168.192.in-addr.arpa" IN {
type master;
file "r.demo.local";
allow-update { none; };
};
};
view wireless{
match-clients {localhost;};
zone "home.com" IN {
type master;
file "home2.zone";
};
};
include "/etc/rndc.key";
将来可能会有更多的视图和区域。如何使用正则表达式匹配 named.conf 文件中的单独视图
组 1 :
查看局域网 { ... };
第 2 组 :
查看无线 { ... };
谢谢!
试试这个
var regexp = /(?:n| )*view[sSnr ]+?(?=n+ *view|$)/g
假设节点.js环境
var namedConf = fs.readFileSync('named.conf');
var matches = namedConf.match(/view lan {(.*)};s*view wireless{(.*)}/);