Improve regex so tags are returned in correct order