Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

140
Views
Using regex to remove http/https and trailing slashes at the end of string

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(/\/+$/, '');
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!