I am trying to do the following in python.
I have a file with the following content…
<VirtualHost>
ServerName blah.com
DocumentRoot /var/www/blah.com
</Virtualhost>
<VirtualHost>
ServerName blah2.com
DocumentRoot /var/www/blah2.com
</Virtualhost>
... etc
I want to take each of these virtual host containers and place them in a separate file(or variable and I can work from there)…
I have been able to take the data in between the strings but not including them. So the output would be …
<VirtualHost>
ServerName blah2.com
DocumentRoot /var/www/blah2.com
</Virtualhost>
...iterated through each container and not...
ServerName blah2.com
DocumentRoot /var/www/blah2.com
Please let me know if this is something that can easily be done. Thanks!
A findall regex might work:
Or to include the
<VirtualHost>parts: