Community
    • Login

    Search & Replace syntax

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    2 Posts 2 Posters 50 Views 1 Watching
    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.
    • K Offline
      KRadiants
      last edited by

      Hello, I am trying to find and replace but I’m having trouble with it as I’m not good at computers.

      Here is the data I currently have (“before” data):

      SelectSpells(c213ca01-3767-457b-a5c8-fd4c1dd656e2,1,1)
      

      Here is how I would like that data to look (“after” data):

      SelectSpells(c213ca01-3767-457b-a5c8-fd4c1dd656e2)
      

      Sometimes there is something after the two digits. What I need to delete are the two digits so that it looks like this at the end

      SelectSpells (StringsOfNumbers)
      

      To accomplish this, I have tried using the following Find/Replace expressions and settings

      • Find What = SelectSpells[^>]\d,\d
        SelectSpells[^],[0-9],[0-9]
        SelectSpells[\a+][\d 0-9],[\d 0-9]
        And many more I don’t remember
      • Replace With = None yet.
      • Search Mode = Regular Expression
      • Dot Matches Newline = I don’t know what that is, sorry

      I thought it would work because my friend who’s better at computer thought it would as we’re checking the user manual, but we’re stumped

      I’d appreciate any help, thanks

      CoisesC 1 Reply Last reply Reply Quote 0
      • CoisesC Offline
        Coises @KRadiants
        last edited by

        @KRadiants:

        You probably want something like this:

        Find what: ^(SelectSpells\([\d\-abcdef]+),\d+,\d+
        Replace with: $1

        That is making a few assumptions:

        1. That “SelectSpells(” always starts at the beginning of a line, with nothing (not even blanks) before it, and it’s immediately followed by the id number you want to keep.

        2. That the id number is always made up of some combination of digits, the letters a-f, and hyphens.

        3. That the part you want to remove is always a comma, one or more digits, a comma, and one or more digits. No blanks, no extra commas, no letters or hyphens or anything else.

        4. That once you remove that, if there is anything after the two commas and numbers, you want to keep all of it.

        If one of those assumptions is not true, you’ll have to explain more precisely what is true.

        1 Reply Last reply Reply Quote 0

        Hello! It looks like you're interested in this conversation, but you don't have an account yet.

        Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

        With your input, this post could be even better 💗

        Register Login
        • First post
          Last post
        The Community of users of the Notepad++ text editor.
        Powered by NodeBB | Contributors