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.
    • SaiapatsuS
      Saiapatsu
      last edited by

      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.

      QiShQ 42Q 3 Replies Last reply Reply Quote 2
      • QiShQ 42Q
        QiShQ 42 @Saiapatsu
        last edited by

        @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

        SaiapatsuS 1 Reply Last reply Reply Quote 0
        • QiShQ 42Q
          QiShQ 42 @Saiapatsu
          last edited by

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

          1 Reply Last reply Reply Quote 0
          • QiShQ 42Q
            QiShQ 42 @Saiapatsu
            last edited by

            @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
            • SaiapatsuS
              Saiapatsu @QiShQ 42
              last edited by Saiapatsu

              This post is deleted!
              1 Reply Last reply Reply Quote 0
              • QiShQ 42Q
                QiShQ 42 @QiShQ 42
                last edited by

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

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

                  @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.

                  QiShQ 42Q 2 Replies Last reply Reply Quote 2
                  • QiShQ 42Q
                    QiShQ 42 @Alan Kilborn
                    last edited by

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

                    1 Reply Last reply Reply Quote 0
                    • QiShQ 42Q
                      QiShQ 42 @Alan Kilborn
                      last edited by QiShQ 42

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

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

                        @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.

                        QiShQ 42Q 1 Reply Last reply Reply Quote 2
                        • QiShQ 42Q
                          QiShQ 42 @Alan Kilborn
                          last edited by

                          @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
                          • QiShQ 42Q QiShQ 42 deleted this topic on
                          • QiShQ 42Q QiShQ 42 restored this topic on
                          • First post
                            Last post
                          The Community of users of the Notepad++ text editor.
                          Powered by NodeBB | Contributors