Community

    • Login
    • Search
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search

    Find & Replace question with RegEx solution

    Help wanted · · · – – – · · ·
    1
    2
    51
    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.
    • JustinJudo
      JustinJudo last edited by JustinJudo

      I have a URL that is like so:
      https://preview.redd.it/7zssyhn54gxa1.jpg?blah_blah

      I need the word ‘preview’ replaced with the letter i (lowercase I). And then everything after the ? replaced with nothing. Actually I need the question mark to be deleted as well.

      This is the end result I need:
      https://i.redd.it/7zssyhn54gxa1.jpg

      Fixing just 1 URL like this would be very simple but I have multiple URLs with this pattern. They are all on separate lines. I’d appreciate any help I can get.

      JustinJudo 1 Reply Last reply Reply Quote 0
      • JustinJudo
        JustinJudo @JustinJudo last edited by JustinJudo

        I did some googling and found a RegEx solution:

        Find:

        \?.*$
        

        Replace with:
        (null)

        1 Reply Last reply Reply Quote 0
        • First post
          Last post
        Copyright © 2014 NodeBB Forums | Contributors