I do not know if I understand. Would you like to take the first 54 lines of a text?
Is this what you are trying to do?
(.*\n){54}
If it is not, of more details showing what you have on the screen, and what you want to get. It would be easier to understand by visualizing what you have and what you want.
EDITED
I do not know if you can use naming the catch, but if you can, I think that would make it easier:
/(?P<paragrafo>.*)(.*\n){1,54}/g
Or so it should work:
/(.*)(.*\n){1,54}/g
The first capture (.*)
will take the first paragraph, the second capture (.*\n){1,54}
will take 54 paragraphs counting also the first one. But then in your code just ignore this second capture. And the modifier at the end /g
will ensure that the regex will take captures as long as you find text.
The schematic that I put {1,54}
is that it will execute until the end, even if the last capture battery does not have 54 complete paragraphs. If you put it just like this: {54}
It will require that all capture batteries have 54 paragraphs, and if the last one has for example 53 paragraphs or less, it will ignore and will not execute the first capture of the last battery.
I hope you have not been so confused to understand ^^