1

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
  • 133
  • 1
  • 10

0 Answers0