0

I have a very large list of URLs in a Notepad++ file that I would like to cut down. Specifically, I want to remove all URLs with text after the URL's third backslash (after HTTPS).

So my urls in this text document look like this (example URL of course):

https://www.google.com/goo/google/extra I want to remove URLs with text after that third backslash. So delete all URLs from this document with anything where "extra" is, but not target the third backslash itself. So lines like this would be deleted https://www.google.com/goo/google/deleted and lines like this https://www.google.com/goo/google/ would be saved. I hope I explained this well it really is more complicated in my head than I think it is to actually execute.

1
  • Are URLs alone in a line? Is there some other text? Do you want to remove linebreaks? Please, edit your question and add extract of your file and expected result. Commented May 26, 2019 at 16:54

1 Answer 1

3

You can use a regular-expression search-and-replace: Use Ctrl-H to open the Replace dialog, use Alt-G to set the Search mode to Regular expression, use the expression

`https://[^/\s]+/[^/\s]+/[^/\s]+/[^\s]+\r?\n?`

as Find what and leave Replace with empty. Then click on Replace all.

The expression searches for https URLs with the wanted number of minimum slashes (and non-slash and non-space characters between them) and replaces it, including any line ending characters, with nothing. This assumes you have one URL per line. If URLs could occur anywhere in text, you probably want to remove the \r?\n? part from the end of the expression.

Sign up to request clarification or add additional context in comments.

1 Comment

I'm glad it worked. If you're satisfied with the answer, please do not only upvote it, but also mark it as accepted. Thanks!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.