I need to match a series of repeating VirtualHost configs in Javascript, Example:
...
# First VHost...
<VirtualHost *:80 *:8082>
# Any number of configs
# and set up options for
# Apache
</VirtualHost>
# Second VHost...
<VirtualHost *:80 *:8082>
# Any number of configs
# and set up options for
# Apache
</VirtualHost>
# Third VHost...
<VirtualHost *:80 *:8082>
# Any number of configs
# and set up options for
# Apache
</VirtualHost>
....
My current RegEx Pattern is:
/<VirtualHost[*:0-9\s]+>([\S\s]+)<\/VirtualHost>/g
I understand that my capturing group is the reason I am getting only one matched set (the whole string as it were), but I don't know how else to capture what is between the VirtualHost blocks.
What I'd like to put output is an array that is: [<first vhost>, <second vhost>, <third vhost>, ...] Any help would be wonderful!