• Login
Community
  • Login

how can i find 2 char with a specific number of line between them please see the screen shoot

Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
13 Posts 3 Posters 1.2k 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.
  • Q
    QiShQ 42
    last edited by Nov 22, 2021, 5:34 PM

    Untitled Project .jpg

    so as u see i want to find all the "B"s that between them 9 lines ,im new to regex search

    and i want to know how can i do it in another situation where there is longer lines with alot of numbers and special characters

    Q 2 Replies Last reply Nov 22, 2021, 5:42 PM Reply Quote 0
    • Q
      QiShQ 42 @QiShQ 42
      last edited by Nov 22, 2021, 5:42 PM

      @qishq-42 col search

      1 Reply Last reply Reply Quote 0
      • S
        Saiapatsu
        last edited by Nov 22, 2021, 5:45 PM

        This regex might work:
        B\n[^\n]*\n[^\n]*\n[^\n]*\n[^\n]*\n[^\n]*\n[^\n]*\n[^\n]*\n[^\n]*\n[^\n]*\nB
        B is the letter B
        [^\n]* is any amount of anything that isn’t a newline
        \n is a newline
        Thus, this will find two Bs with exactly 9 newlines in the text between them, no more or less.
        This will also find Bs that have other Bs between them in these 9 lines. To fix that, change [^\n]* to [^B\n]* so that any of the lines between the two Bs cannot contain B.

        Q 3 Replies Last reply Nov 22, 2021, 5:53 PM Reply Quote 2
        • Q
          QiShQ 42 @Saiapatsu
          last edited by Nov 22, 2021, 5:53 PM

          @saiapatsu thank you for fast replaying , it didnt work i tried also B\n[^\n]*\nB means one line between them right? it didnt work neither

          S 1 Reply Last reply Nov 22, 2021, 6:04 PM Reply Quote 0
          • Q
            QiShQ 42 @Saiapatsu
            last edited by Nov 22, 2021, 5:59 PM

            @saiapatsu i guess there is somthing missing in the start of your regex

            1 Reply Last reply Reply Quote 0
            • Q
              QiShQ 42 @Saiapatsu
              last edited by Nov 22, 2021, 6:02 PM

              @saiapatsu said in how can i find 2 char with a specific number of line between them please see the screen shoot:

              B\n[^\n]*\n

              i got it at the start [B\n[^\n]\n… i had to remove the \n so it looks like this [B[^\n]\n…

              thank you very much

              1 Reply Last reply Reply Quote 1
              • S
                Saiapatsu @QiShQ 42
                last edited by Saiapatsu Nov 22, 2021, 6:04 PM Nov 22, 2021, 6:04 PM

                This post is deleted!
                1 Reply Last reply Reply Quote 0
                • Q
                  QiShQ 42 @QiShQ 42
                  last edited by Nov 22, 2021, 6:08 PM

                  @qishq-42
                  im wondering how can i find it in this situation
                  Untitled Project 2.jpg

                  A 1 Reply Last reply Nov 22, 2021, 6:13 PM Reply Quote 0
                  • A
                    Alan Kilborn @QiShQ 42
                    last edited by Nov 22, 2021, 6:13 PM

                    @qishq-42

                    If you had 5 lines between the ones that started with the Bs, you could use this:

                    (?-s)^B(.*\R){6}B

                    Note that the 6 relates to the 5 you want – it is one more than the desired.

                    Q 2 Replies Last reply Nov 22, 2021, 6:21 PM Reply Quote 2
                    • Q
                      QiShQ 42 @Alan Kilborn
                      last edited by Nov 22, 2021, 6:21 PM

                      @alan-kilborn it is working! Impressive! thank you man

                      1 Reply Last reply Reply Quote 0
                      • Q
                        QiShQ 42 @Alan Kilborn
                        last edited by QiShQ 42 Nov 22, 2021, 6:23 PM Nov 22, 2021, 6:23 PM

                        @alan-kilborn one question how can i exclude the B from being in one of those 5 lines?

                        A 1 Reply Last reply Nov 22, 2021, 6:28 PM Reply Quote 0
                        • A
                          Alan Kilborn @QiShQ 42
                          last edited by Nov 22, 2021, 6:28 PM

                          @qishq-42 said in how can i find 2 char with a specific number of line between them please see the screen shoot:

                          one question how can i exclude the B from being in one of those 5 lines?

                          I suppose you then want this?:

                          (?-s)^B([^B]*\R){6}B

                          Suggest you read about regex and Notepad++ starting with references HERE.

                          Q 1 Reply Last reply Nov 22, 2021, 6:34 PM Reply Quote 2
                          • Q
                            QiShQ 42 @Alan Kilborn
                            last edited by Nov 22, 2021, 6:34 PM

                            @alan-kilborn 100% thanks , sorry i know that it is basic questions because i just started today but i had to ask here :), ok i will check it out

                            1 Reply Last reply Reply Quote 0
                            • Q QiShQ 42 deleted this topic on Nov 29, 2021, 9:18 AM
                            • Q QiShQ 42 restored this topic on Dec 12, 2021, 11:13 PM
                            7 out of 13
                            • First post
                              7/13
                              Last post
                            The Community of users of the Notepad++ text editor.
                            Powered by NodeBB | Contributors