Improved regex to validate URLs