not sure if this can be done...
-
hi, im kind of new noob user can you help me with this? i will try to explain,
first im taking first 10 lines (1 to 10) and counting how many 7s,10s,Bs…in there and after that i try to find another 10 lines that have the same number of 7s,10s,Bs… with random order , so how can i do it? -
That sounds like a programming challenge, not something that a text editor should do.
If you know or are willing to learn the Python programming language, you could use the PythonScript plugin in Notepad++ to give your program easy access to the file open in Notepad++, to facilitate your task. And there are similar programs for other languages, like Lua or JavaScript.
But in the end, it’s a programming problem.
-
@qishq-42 said in not sure if this can be done...:
i try to find another 10 lines that have the same number of 7s,10s,Bs… with random order , so how can i do it?
I’ve had a think and also looked at your previous request about 3 weeks ago, very similar to this. That request looks like it was solved by a regular expression, this however I don’t think can be.
I’m going to suggest it would require using a programming language such as PythonScript which is available inside of Notepad++. However I’m not a programmer. In english terms it would require:
- reading the first 10 lines and storing the number of 7, 10 and B’s
- setting a pointer just beyond the first 10 lines then
- reading the next 10 lines and counting within that character string each of the variables and comparing. If found to be the same number then stop else
- advance the pointer 1 line and repeat step #3
Terry
PS just about to post when I see @PeterJones backs up my theory.
-
@terry-r @PeterJones
thank you guys , i wasn’t sure about this , i guess that this can be done with regex but it is complicated for example :
if we have 3 lines :
10
7
B
so we have to calculate the possibility of the orders which is 3!=3x2x1=6
and the 6 possibilities are:
107B,10B7,710B,7B10,B710,B107
now that can be translated to regex i guess like this:
1[^\n]\n2[^\n]\n3|
1[^\n]\n3[^\n]\n2|
2[^\n]\n1[^\n]\n3|
2[^\n]\n3[^\n]\n1|
3[^\n]\n2[^\n]\n1|
3[^\n]\n1[^\n]\n2the problem is with 10 lines there is 10! which is big number im looking for a way to make this simpler is that possible?
i will check that plugin by the way
-
@qishq-42 said in not sure if this can be done...:
im looking for a way to make this simpler is that possible?
Yes, it’s called programming.
Regex doesn’t have the concept of counting that your desired algorithm requires. You either have to set up the N! conditionals in the regex, or you have to use a tool – like a programming language – that handles counting and other such conditional tasks much more simply than can be done in regular expressions.