Community
    • 登入

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

    已排程 已置頂 已鎖定 已移動 Help wanted · · · – – – · · ·
    3 貼文 3 Posters 254 瀏覽
    正在載入更多貼文
    • 從舊到新
    • 從新到舊
    • 最多點贊
    回覆
    • 在新貼文中回覆
    登入後回覆
    此主題已被刪除。只有擁有主題管理權限的使用者可以查看。
    • SquirtleshellS
      Squirtleshell
      最後由 編輯

      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 條回覆 最後回覆 回覆 引用 0
      • astrosofistaA
        astrosofista @Squirtleshell
        最後由 編輯

        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 條回覆 最後回覆 回覆 引用 2
        • AdrianTweeterA
          AdrianTweeter
          最後由 編輯

          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 條回覆 最後回覆 回覆 引用 3
          • 第一個貼文
            最後的貼文
          The Community of users of the Notepad++ text editor.
          Powered by NodeBB | Contributors