Community
    • Login

    Break Text ever x Characters (keeping sentence / paragraphs)

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    3 Posts 2 Posters 421 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Andrew CaseyA
      Andrew Casey
      last edited by

      Hi there

      I am not sure if what I am after is possible

      I have a very long block of text - split into paragraphs.

      What I want to do is put a break into the text ie:

      ================

      every 4000 characters

      However, I want to keep the sentence or even better the paragraph structure if possible - so it auto places the break before it if the text is broken

      (ie so it does not cut off halfway through a paragraph )

      Thank and hope someone can point me in the right direction

      sample text showing the breaks
      2023-11-02_10-33-44.jpg

      CoisesC 1 Reply Last reply Reply Quote 0
      • CoisesC
        Coises @Andrew Casey
        last edited by

        @Andrew-Casey Make a safety copy of your document, then try:

        From the menu bar, select Search | Replace.

        In the dialog, fill in:

        Find what: (?s)^.{1,4000}(\R\R)\K
        Replace with: =============================$1
        Selection Mode: Regular expression

        then click Replace All.

        Andrew CaseyA 1 Reply Last reply Reply Quote 6
        • Andrew CaseyA
          Andrew Casey @Coises
          last edited by

          @Coises Wow that is amazing - will save so much time thanks

          1 Reply Last reply Reply Quote 0
          • First post
            Last post
          The Community of users of the Notepad++ text editor.
          Powered by NodeBB | Contributors