Community
    • Login

    See if notepad++ meets some of my needs

    Scheduled Pinned Locked Moved General Discussion
    7 Posts 4 Posters 605 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.
    • N
      nightrider43
      last edited by

      Hey guys!
      I would like to propose some situations and see if notepad++ meets them:

      1. Show all lines that contain an asterisk in column 7;
      2. Show all lines that contain the word MOVE between columns 23 and 42;
      3. Replace the word MOVE with the word SET only between columns 27 and 93;
      4. Show all lines that contain the word MOVE or the word WRITE;
      5. Show all lines that contain the word MOVE and the word WRITE;

      Cheers

      Arí Ricardo
      São Paulo - Brazil

      PeterJonesP 1 Reply Last reply Reply Quote 0
      • PeterJonesP
        PeterJones @nightrider43
        last edited by PeterJones

        @nightrider43 said in See if notepad++ meets some of my needs:

        Hey guys!
        I would like to propose some situations and see if notepad++ meets them:

        1. Show all lines that contain an asterisk in column 7;
        2. Show all lines that contain the word MOVE between columns 23 and 42;
        3. Replace the word MOVE with the word SET only between columns 27 and 93;
        4. Show all lines that contain the word MOVE or the word WRITE;
        5. Show all lines that contain the word MOVE and the word WRITE;

        Assuming you mean “find all lines”, not “show the matching lines and hide any others”, then yes, all of those are quite doable using Notepad++'s search dialog in Search Mode = Regular Expression mode.

        1. FIND = ^......\*
        2. FIND = ^.{22,38}MOVE
        3. FIND = ^.{26,90}\KMOVE
          REPLACE = SET
        4. FIND = ^.*(MOVE|WRITE)
        5. FIND = ^(?=.*aaa)(?=.*bbb).*$

        (The last was derived from Logic Gates for Regular Expressions)

        All of those regex assume you have chosen Search Mode = Regular Expression and assume you have not checkmarked the . matches newline option

        Some of the column counts (the numbers in {curly braces}) may be off by a few from your definition, depending on whether “MOVE between columns 23 and 42” means “M could be as early as 23 or as late as 42 ⇒ .{22,41}” or “M could be as early as 23 or the final letter E as late as 42 so the M can only be as late as 39 ⇒ .{22,38}” or “‘between’ is non-inclusive, so M must be after 23 and E must be before 42 ⇒ .{23,37}” … similarly on the other numerical entries.

        Except on item 3, if you want them to select the whole line instead of just the first portion until the match, add .*$ to the end of the regular expression

        ----

        Useful References

        • Please Read Before Posting
        • Template for Search/Replace Questions
        • Formatting Forum Posts
        • Notepad++ Online User Manual: Searching/Regex
        • FAQ: Where to find other regular expressions (regex) documentation
        1 Reply Last reply Reply Quote 8
        • wonkawillyW
          wonkawilly
          last edited by

          Hi all
          About Showing all lines that contain something you’re looking for, you can also use use Find dialog by clicking on “Find All in Current Document” button: N++ will open a Search results pane where it lists all the lines that contain hits.
          This also works on multiple files: clicking on Find All in All Opened Documents button.
          Also in Find in files tab page of the Find dialog is possible to search in directory trees performing a bunch of action on the files they contain.
          And in Find in Projects tab page is possible to search in N++ Projects also ( you can define a project by using Menu View > Project Panels > … sub menu)
          Another thing you can also with the help of the Find dialog is going to the *Mark tab page and check *Bookmark line, than click on Mark All: a bookmark (a blue circle/sphere like icon ) is added at the left side of the the lines containing matches and the matches themselves are highlighted with a background color. At this point you can go to menu Search > Bookmark > Copy [or Cut or Remove] Bookmarked lines (or the others). If you perform a copy or cut action on them from such sub menu, you can paste them into another file, for instance to have them all in one place and edit as you need them all, with ease.

          Alan KilbornA 1 Reply Last reply Reply Quote 0
          • Alan KilbornA
            Alan Kilborn @wonkawilly
            last edited by

            @wonkawilly said in See if notepad++ meets some of my needs:

            Also in Find in files tab page of the Find dialog is possible to search in directory trees performing a bunch of action on the files they contain.

            If by “bunch of action” you mean “find” or “replace” (not sure that is a “bunch”), then you are correct.

            wonkawillyW 1 Reply Last reply Reply Quote 1
            • wonkawillyW
              wonkawilly @Alan Kilborn
              last edited by

              @Alan-Kilborn said in See if notepad++ meets some of my needs:

              @wonkawilly said in See if notepad++ meets some of my needs:

              Also in Find in files tab page of the Find dialog is possible to search in directory trees performing a bunch of action on the files they contain.

              If by “bunch of action” you mean “find” or “replace” (not sure that is a “bunch”), then you are correct.

              I accurately Define “bunch” in Find in Files:

              1 Normal Find [& Replace]
              2 Extended Find [& Replace]
              3 RegEx Find [& Replace]
              4 Filter the files the user wants to Find [& Replace] in
              5 Follow current doc to Find [& Replace] in its dir (I suppose, but I’ve never used this option)
              6 Chose a dir to Find [& Replace] in and relative sub dirs and also hidden dirs
              7 Discriminate (or not) uppercase / lowercase letters for both Find [& Replace]
              8 Discriminate (or not) whole words for Find [& Replace]

              Since the above actions could be performed as “Find” or “Find & Replace” they are a total of 16 possibilities: IMHO this could be identified as a “bunch” of actions, but of course I am open to learn more about English language semantic nuances / shades and I will be happy to post an errata corrige about my previous post to correct possible errors, if any.

              Alan KilbornA 1 Reply Last reply Reply Quote 0
              • Alan KilbornA
                Alan Kilborn @wonkawilly
                last edited by

                @wonkawilly

                This isn’t really 16 “actions”.
                This is 16 (or how many every) options on a couple of basic actions.
                I don’t know…probably not worth discussing further…

                wonkawillyW 1 Reply Last reply Reply Quote 1
                • wonkawillyW
                  wonkawilly @Alan Kilborn
                  last edited by

                  @Alan-Kilborn said in See if notepad++ meets some of my needs:

                  @wonkawilly
                  probably not worth discussing further…

                  I also agree

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