0

I need to remove 'http://' or 'https://' from a string if it exists, and also any trailing slashes at the end of a string.

So, with a string like 'https://yourdomain.com//////', it should return yourdomain.com.

Currently I have the following two regex patterns separately, but I don't know how to combine them.

url.replace(/^https?:\/\//, '');

url.replace(/\/+$/, '');
Prajwal
  • 71
  • 7

0 Answers0