Hi All, Please please please ....can someone save me from further headaches. Bascially the regex will match the header (lines with hashes) to the </VirtualHost> giving me what I need into %virtual_host.
However if there is a blank line as shown for server 1 the regex wont match. Can any regex gurus help me with this???? Oh and please feel free to point out any cockups ive made :) Kind regards Mark. The code ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ sub open_httpd { open(FH, "<". @_[0]) or die print "Cannot read @_[0]"; local $/ = ''; while (<FH>) { while (/^([#]{50}\n## [Ss]erver +?([0-9]+).*^(<VirtualHost(.*)>(.*)^<\/VirtualHost>)\n$)$/smg) { if (!exists $virtual_host{$2}){ $virtual_host{$2}=$1; }else { warn "Duplicate Virtual Host ID $2 found at $.\n"; } } } } Sample Data ~~~~~~~~~~~~~~~~~~~~ ################################################## ## Server 1 ## ## WWW.SOMEHOST.COM ## ## Date 06/10/2001 By MEK ## ## ## ################################################## <VirtualHost xxx.xxx.xxx.xxx> ServerAdmin [EMAIL PROTECTED] DocumentRoot /serv/apache/somepath ServerName www.somehost.net DirectoryIndex index.html index.htm INDEX.HTML INDEX.HTM index.shtml FancyIndexing on AccessFileName .htaccess DefaultType text/plain ScriptAlias /cgi-bin /serv/apache/somepath/cgi-bin ErrorLog /serv/apache/somepath/logs/error_log TransferLog /serv/apache/somepath/logs/transfer_log </VirtualHost> ################################################## ## Server 2 ## ## WWW.SOMEHOST2.COM ## ## Date 06/10/2001 By MEK ## ## ## ################################################## <VirtualHost xxx.xxx.xxx.xxx> ServerAdmin [EMAIL PROTECTED] DocumentRoot /serv/apache/somepath2 ServerName www.somehost2.net DirectoryIndex index.html index.htm INDEX.HTML INDEX.HTM index.shtml FancyIndexing on AccessFileName .htaccess DefaultType text/plain ScriptAlias /cgi-bin /serv/apache/somepath2/cgi-bin ErrorLog /serv/apache/somepath2/logs/error_log TransferLog /serv/apache/somepath2/logs/transfer_log </VirtualHost> ################################################## ## Server 3 ## ## WWW.SOMEHOST3.COM ## ## Date 06/10/2001 By MEK ## ## ## ################################################## <VirtualHost xxx.xxx.xxx.xxx> ServerAdmin [EMAIL PROTECTED] DocumentRoot /serv/apache/somepath3 ServerName www.somehost3.net DirectoryIndex index.html index.htm INDEX.HTML INDEX.HTM index.shtml FancyIndexing on AccessFileName .htaccess DefaultType text/plain ScriptAlias /cgi-bin /serv/apache/somepath3/cgi-bin ErrorLog /serv/apache/somepath3/logs/error_log TransferLog /serv/apache/somepath3/logs/transfer_log </VirtualHost> -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]