Thread: Regex examples
View Single Post
Old 05-20-2020, 03:03 PM   #640
wrCisco
Enthusiast
wrCisco ought to be getting tired of karma fortunes by now.wrCisco ought to be getting tired of karma fortunes by now.wrCisco ought to be getting tired of karma fortunes by now.wrCisco ought to be getting tired of karma fortunes by now.wrCisco ought to be getting tired of karma fortunes by now.wrCisco ought to be getting tired of karma fortunes by now.wrCisco ought to be getting tired of karma fortunes by now.wrCisco ought to be getting tired of karma fortunes by now.wrCisco ought to be getting tired of karma fortunes by now.wrCisco ought to be getting tired of karma fortunes by now.wrCisco ought to be getting tired of karma fortunes by now.
 
Posts: 49
Karma: 605108
Join Date: Apr 2016
Device: none
If "line 14" means the fourteenth line of code (as opposed to the book's textual content), the regex could be:
Code:
Find: ((?:.*?\R){13}).*?\R
Replace: \1
(The search must be executed WITHOUT the DotAll option selected and must start at the beginning of each file).

That's a risky operation, since newlines can be easily added or removed by many automatic formatting processes, but if one is absolutely certain that the text between the thirteenth and the fourteenth newline in the code must be deleted (along with the fourteenth newline), that's one way to do it.

If, instead, "line 14" is not a reference to the lines of xhtml code, you can ignore this contribution and should provide some meaningful pattern as the others already said.
wrCisco is offline   Reply With Quote