Updated regex to handle \n and > at the start of the url