• Login
Community
  • Login

Break Text ever x Characters (keeping sentence / paragraphs)

Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
3 Posts 2 Posters 426 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.
  • A
    Andrew Casey
    last edited by Nov 1, 2023, 9:35 PM

    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

    C 1 Reply Last reply Nov 1, 2023, 10:23 PM Reply Quote 0
    • C
      Coises @Andrew Casey
      last edited by Nov 1, 2023, 10:23 PM

      @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.

      A 1 Reply Last reply Nov 1, 2023, 10:41 PM Reply Quote 6
      • A
        Andrew Casey @Coises
        last edited by Nov 1, 2023, 10:41 PM

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

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