how can i find 2 char with a specific number of line between them please see the screen shoot
-
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
-
@qishq-42 col search
-
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. -
@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
-
@saiapatsu i guess there is somthing missing in the start of your regex
-
@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
-
This post is deleted! -
@qishq-42
im wondering how can i find it in this situation
-
If you had 5 lines between the ones that started with the
B
s, 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. -
@alan-kilborn it is working! Impressive! thank you man
-
@alan-kilborn one question how can i exclude the B from being in one of those 5 lines?
-
@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.
-
@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
-
-