Substituted forEach method for a RegEx match - unrecognised urls do not hang the server anymore