Use a sub array for individual entries and beef up regex

Trying to deal with both numeric and associative indexes was causing issues
for which post was processed when, and the network library was having its
media removed. Moving the images to a sub array fixes this.

The regex has been moved to a submethod so that it can be further validated
and ensure any slashes are escaped, multiple periods wont cause issues with
the extension replace, and special characters are wrapped in non-capturing
groups so they don't affect the actual match beyond matching themselves.