Sublime Forum

Remove duplicate "urls"

#1

Hey guys,

I am trying to sort some URL’s on my website and my list looks like this:


Is there a way i can sort / remove every link with duplicated domain? (I have more links but could only paste 2)

0 Likes

#2

There are functions to sort & permute lines.

  1. Open the command palette with Ctrl + Shift + P
  2. Run these commands:
  • Sort Lines
  • Permute Lines: Unique

 

However, that solution requires that your entries are EXACT matches
( EG:  https://ollygames.com   &   http://ollygames.com   would each be seen as unique entries )

 

Also, in order for that to work, you would have to trim all subdomains via a RegEx find/replace or something.

You could use something like (?<=\.(com|org|net)).* as your find query ( with RegEx Enabled ) and leave the replace field blank.
 



 
That’s the [ quickest | easiest ] way to go about it, assuming it matches the requirements of your source content & end results.

A more specific solution would be to write a plugin that compares RegEx results within the selection & removes lines with more than one match.

1 Like

#3

Okay I see, will try it our thx!

Have to play around with RegEx probably :slightly_smiling:

1 Like