Hi, actualy i have a very complex problem, but i have narrowed it down here to the most essential part with some dummy-data.
Say i have the folowing text:
a
aa
aaa
aaaa
aaaa
aaaaa
a
aa
aaa
aaaa
aaaaa
aaaaaa
aaaa
a
What i would like to do is, FOR EXAMPLE when a line of 4 a's is followed by a line of 1 a. I'd like to add a line of 3 a's after the line of 4, and add a line of 2 a's after the line of 3. So the result would be this:
a
aa
aaa
aaaa
aaaa
aaaaa
aaaa
aaa
aa
a
aa
aaa
aaaa
aaaaa
aaaaaa
aaaaa
aaaa
aaa
aa
a
I have tried the folowing regex in editpad pro:
find: \r?\n(a*)aa\r?\n\1\r?\n
repl: \n\1aa\n\1a\n\1\n
But this only works when the next line has exactly 2 a's less than the previous one.. I know I could write a bunch of regular expressions like the one above, to work for difference of 2 a's, 3 a's, 4 a's, 5 a's and so on. But i'd like to have only one regex. I don't mind if i would have to run that regex multiple times though..
Any thoughts?