Note that there are some explanatory texts on larger screens.

plurals
  1. PORegular Expression in gVim to Remove Duplicate Domains from a List
    text
    copied!<p>I need a regular expression written to use in gVim that will remove duplicate domains from a list of URLs (gVim can be downloaded here: <a href="http://www.vim.org/download.php" rel="nofollow">http://www.vim.org/download.php</a></p> <p>I have a list of over 6,000,000 URLs in a .txt file (which opens in gVim for editing).</p> <p>The URLs are in this format:</p> <pre class="lang-none prettyprint-override"><code>http://www.example.com/some-url.php http://example2.com/another_url.html http://example3.com/ http://www.example4.com/anotherURL.htm http://www.example.com/some-url2.htm http://example.com/some-url3.html http://www.example2.com/somethingelse.php http://example5.com </code></pre> <p>In other words, there is no specific format to the URLs. Some have the WWW, some don't, they all have different formats.</p> <p>I need a regular expression written for gVim that will remove all duplicate DOMAINs from the list (and it's corresponding URL), leaving behind the first instance it finds.</p> <p>So it would take the example list posted above, and the end result should look like this:</p> <pre class="lang-none prettyprint-override"><code>http://www.example.com/some-url.php http://example2.com/another_url.html http://example3.com/ http://www.example4.com/anotherURL.htm http://example5.com </code></pre> <p>Here are two nice sites that explain how to use regular expressions within gVim pretty nicely:</p> <p><a href="http://supportweb.cs.bham.ac.uk/documentation/tutorials/docsystem/build/tutorials/gvim/gvim.html#Vi-Regular-Expressions" rel="nofollow">http://supportweb.cs.bham.ac.uk/documentation/tutorials/docsystem/build/tutorials/gvim/gvim.html#Vi-Regular-Expressions</a></p> <p><a href="http://www.softpanorama.org/Editors/Vimorama/vim_regular_expressions.shtml" rel="nofollow">http://www.softpanorama.org/Editors/Vimorama/vim_regular_expressions.shtml</a></p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload