• Login
Community
  • Login

Keep only specific links

Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
4 Posts 2 Posters 1.2k Views
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T
    T C
    last edited by Apr 27, 2018, 6:16 PM

    Hi.

    How can I keep links like this:

    https://archiveofourown.org/works/120628

    and not links like these:

    https://archiveofourown.org/works/120628#comments
    https://archiveofourown.org/works/120628/bookmarks
    https://archiveofourown.org/works/120628?show_comments=true#comments

    Thanks so much

    S 1 Reply Last reply Apr 27, 2018, 8:02 PM Reply Quote -1
    • S
      Scott Sumner @T C
      last edited by Apr 27, 2018, 8:02 PM

      @T-C

      What you want is a little loosely defined. For example, this will do it, but I sense you want something more generic over the whole expression:

      Find what zone: (?-s)https://archiveofourown\.org/works/120628(?=[#/?]).+\R
      Replace with zone: make sure this is EMPTY
      Search mode: Regular expression

      It also assumes that the lines end where shown above by the OP, but this is somewhat of an arbitrary assumption…

      Hmmm…don’t know that this actually deserves a down-vote…whomever did that…

      1 Reply Last reply Reply Quote 0
      • T
        T C
        last edited by Apr 28, 2018, 7:58 AM

        Another option was to mark lines that had only links like this:

        https://archiveofourown.org/works/ 14272356

        The numbers in bold are different every time.

        S 1 Reply Last reply Apr 28, 2018, 11:46 AM Reply Quote 0
        • S
          Scott Sumner @T C
          last edited by Apr 28, 2018, 11:46 AM

          @T-C

          Again, what you are trying to achieve is vague. You’re not going to get the best help that way (and you may even get down-voted again).

          So…first you wanted to delete text, now you want to mark text…which is it?

          You can match a number that is different every time by using \d+ in the expression where the number occurs.

          1 Reply Last reply Reply Quote 0
          2 out of 4
          • First post
            2/4
            Last post
          The Community of users of the Notepad++ text editor.
          Powered by NodeBB | Contributors