• Login
Community
  • Login

regex - add a new line at the beginning after every point | cut sentences in new line

Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
4 Posts 2 Posters 1.2k 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.
  • N
    Neculai I. Fantanaru
    last edited by Dec 1, 2018, 10:51 AM

    good day. I have many sentences in a single line. For exemple:

    I go home. My mother is with my sister. I love Pepsi. I need somebody to love me. I have to make some exercises.
    

    My desire output:

    I go home. 
    My mother is with my sister.
    I love Pepsi.
    I need somebody to love me.
    I have to make some exercises.
    

    My solution is:

    Search: [=.:].*
    Replace by: \n$0

    But is not quite very best solution, because it brings also the point at the beginning of the new line.

    1 Reply Last reply Reply Quote 0
    • D
      dinkumoil
      last edited by Dec 1, 2018, 11:18 AM

      Search for: \. + (literal full stop with one or more trailing space characters)
      Replace with: .\r\n (full stop with trailing CR+LF)

      1 Reply Last reply Reply Quote 1
      • N
        Neculai I. Fantanaru
        last edited by Neculai I. Fantanaru Dec 1, 2018, 11:25 AM Dec 1, 2018, 11:24 AM

        @dinkumoil said:

        .\r\n

        and if there are many special characters instead of point, such as =:* ? How can I change it?

        For example:

        I go home= My mother is with my sister: I love Pepsi. I need somebody to love me* I have to make some exercises*
        
        1 Reply Last reply Reply Quote 0
        • D
          dinkumoil
          last edited by Dec 1, 2018, 11:29 AM

          Search for: ([.:=*]) +
          Replace with: \1\r\n

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