Line 1
second line
line three
line four
line five
line six
line seven
line eight
line nine
line 10
line 11
line 12
line 13
line 14
line 15
line 16
line 17
in response to the sentence
1st to 15th lines first
I want to group later on line 16 of latter
/(?<first>\A(.*\n){15})(?<latter>.*\z)/
The .*\z
does not match to the end of the string, perhaps because of the first match.
rubular: http://rubular.com/r/AQbZAuF7Xs
Please let me know if there are any regular expressions that I can solve.
The environment is ruby:2.5.1
Thank you for your cooperation.
.
does not include line breaks, and .*\n
should also be written on the assumption that it does not include line breaks.
/(?<first>\A(.*\n){15})(?<latter>(.*\n)*\z)/
How about that?
© 2024 OneMinuteCode. All rights reserved.