Community
    • Login

    How do I remove everything that doesn't have a certain number in it?

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    3 Posts 3 Posters 485 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.
    • SquirtleshellS Offline
      Squirtleshell
      last edited by

      I’m have a list of codes and discount percentage and I’m trying to only keep the 100’s and remove the 50’s.

      OPBD6 | Discount = 50
      WLQN6 | Discount = 100
      AZOR5 | Discount = 50
      KQOY9 | Discount = 50
      GVNE8 | Discount = 50
      

      to

      WLQN6 | Discount = 100
      
      astrosofistaA 1 Reply Last reply Reply Quote 0
      • astrosofistaA Offline
        astrosofista @Squirtleshell
        last edited by

        Hi @Squirtleshell

        One way to get that is as follows:

        Open the Replace dialog (Ctrl + H) and type in:

        Search: ^.+Discount = (?!100).+\R
        Replace: [leave empty]

        Check the Wrap around option
        Select the Regular expression search mode
        Click on the Replace All button

        Have fun!

        1 Reply Last reply Reply Quote 2
        • AdrianTweeterA Offline
          AdrianTweeter
          last edited by

          Another approach uses the Mark lines facility. Use Menu => Search => Mark. Enter = 100 (i.e. =, space, and 100) into ‘Find what’. Ensure that ‘Bookmark line’ and ‘Wrap around’ are selected. Then click on ‘Mark all’. Expect to see blue circles on the found lines. Next use Menu => Search => Bookmark => Remove unmarked lines. That should leave only the wanted lines.

          If all the unwanted lines have = 50 then you could enter that into the ‘Find what’ and then use menu => Search => Bookmark => Remove bookmarked lines.

          For either you could use more complex ‘Find what’ strings with regular expressions.

          1 Reply Last reply Reply Quote 3

          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