[TASK] Streamline regular expression for Resource URLs
The regular expression to split templates finding resource URLs
is prone to breaking in case the match grows too long because it
has no boundaries. This change stops the match earlier, this also
massively increases the matching speed.
Releases: master, 2.3, 2.2