in reply to regex large named.conf parsing
However. I think you can shorten your re:
Since you don't need all the elements found in $2, $3..., why store them?You have: /(zone\s+"$domain"\s+\{\r?\n(.*?)\r?\n(.*?)\r?\n(\s+)?\};(\r +?\n)+)/ Won't this do: /(zone\s+"$domain"\s+\{[^}]+\};[\r\n]+)/o
Should you need them, you can extract them later, when you found a match for the domain.
You should also ad o to your regexp in order to insert $domain's content just once into your re.
|
|---|