Search code examples
notepad++

I trying to add quotation mark at the start of first line and then at the end of every 50th line


I trying to add quotation mark at the start of first line and then at the end of every 50th line I have like 500 plus lines in notepad++ can anyone help

This is what my file look like

your text
your text
your text

and I want it to look like

"your text
your text
your text"

Solution

  • Here is an example for quotes every 3 lines, just modify the number to add quotes every 50 lines.

    • Ctrl+H
    • Find what: (?:.+\R){2}.+
    • Replace with: "$0"
    • TICK Wrap around
    • SELECT Regular expression
    • UNTICK . matches newline
    • Replace all

    Explanation:

    (?:         # non capture group
        .+          # 1 or more any character but newline
        \R          # any kind of linebreak
    ){2}        # end group must appear twice, in your case, you have to use 49 instead of 2
    .+          # 1 or more any character but newline
    

    Replacement:

    "$0"        # whole match sround with quotes
    

    Screenshot (before):

    enter image description here

    Screenshot (after):

    enter image description here