title: removing http:// or http:// and www
body: <p>I am trying to build a url cleaner.</p>
  <p>I am looking to get a list of urls and remove all <code>https://</code>, <code>http://</code>, <code>www.</code>, etc. from the beginning as well as all text after the trailing <code>/</code>.</p>
  <p>I have tried the following regex <code>url.replace(/^https?\:\/\/www\./i, &quot;&quot;).split('/')[0];</code></p>
  <p>This works to a certain extent and outputs the following</p>
  <pre><code>&quot;www.net-temps.com&quot;
  &quot;www.toplanguagejobs.com&quot;
  &quot;http:&quot;
  &quot;peopleready.com&quot;
  &quot;nationjob.com&quot;
  &quot;http:&quot;
  &quot;bluesteps.com&quot;
  &quot;https:&quot;
  &quot;theguardian.com&quot;
  &quot;reddit.com&quot;
  &quot;youtube.com&quot;
  &quot;https:&quot;
  &quot;pgatour.com&quot;
  &quot;cultofmac.com&quot;
  </code></pre>
  <p>from the following list:</p>
  <pre><code>'www.net-temps.com',
  'www.toplanguagejobs.com',
  'http://nychires.com/',
  'http://www.peopleready.com/',
  'https://www.nationjob.com/',
  'http://nationaljobsonline.com/',
  'https://www.bluesteps.com/',
  'https://medium.freecodecamp.com/how-we-got-our-2-year-old-open-source-project-to-trend-on-github-8c25b0a6dfe9#.nl4985bjz',
  'https://www.theguardian.com/uk/business',
  'https://www.reddit.com/r/funny/comments/5qzkz4/my_captain_friend_sent_me_this_photo_saudi_prince/',
  'https://www.youtube.com/watch?v=Bua8k_CcnuI',
  'https://stackoverflow.com/questions/7000995/jquery-removing-part-of-string-after-and-removing-too/7001040#7001040',
  'http://www.pgatour.com/fantasy.html',
  'http://www.cultofmac.com/464645/apple-spaceship-campus-flyover/'
  </code></pre>
  <p>If I remove the <code>/www\.</code> from the regex this works well and removes all <code>https:</code> etc., but I'd also like to remove the <code>www.</code> if it's there regardless of <code>https:</code></p>
  <p>This is what i have coded so far</p>
  <p><a href="https://jsfiddle.net/xba5x9ro/1/" rel="nofollow noreferrer">https://jsfiddle.net/xba5x9ro/1/</a></p>
  <p>In the future once this is sorted. I would like to take a list of urls from a text area run <code>makeDomainBeautiful</code> and output to another textarea but thought I'd get this working first.</p>