Try the following modified regex in the subroutine:
/(?<!#|\/)\s*zone\s+"([^"]+)".+?masters\s+{[\s#\/]*([a-zA-Z0-9.-]+)[\s +#\/;]*}/sg
Added:
(?<!#|\/)\s*zone ^ ^ ^ | | | | | + - 0+ whitespaces | + - Match "zone" and 0+ whitespaces that are not preceded by an " +#" or "/" + - Negative lookbehind
In reply to Re^15: Bind zone file search
by Kenosis
in thread Bind zone file search
by ranceh
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |