Community
    • Login

    Insert new line after every comma, colon AND period mark

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    4 Posts 2 Posters 26.3k Views 1 Watching
    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.
    • Luís GonçalvesL Offline
      Luís Gonçalves
      last edited by Luís Gonçalves

      Hello,

      I want to make a change in a text I have in which after every comma, colon, AND period mark a new line is inserted; but I want to do all of this at the same time, with a single regular expression. Is it possible?

      In the example of my question above, the resulting text would be:

      I want to make a change in a text I have in which after every comma,
      colon,
      AND period mark a new line is inserted;
      but I want to do all of this at the same time,
      with a single regular expression.
      Is it possible?
      

      Thanks in advance!

      P.S.:

      I was doing this, to insert a new line after every comma:

      • Find: \,\s*
      • Replace with: \,\n

      But it isn’t a practical solution, since I have to substitute the comma with the other characters, and the text is BIG.

      Alan KilbornA 1 Reply Last reply Reply Quote 1
      • Alan KilbornA Offline
        Alan Kilborn @Luís Gonçalves
        last edited by

        @Luís-Gonçalves said in Insert new line after every comma, colon AND period mark:

        I want to make a change in a text I have in which after every comma, colon, AND period mark a new line is inserted; but I want to do all of this at the same time, with a single regular expression. Is it possible?

        Find: [,:.]
        Replace: \r\n
        Search mode: Regular expression

        Note: If you have “Windows files” which is most-typical, do not use \n without \r in front of it, when replacing. Otherwise, you may “corrupt” your data.

        1 Reply Last reply Reply Quote 1
        • Luís GonçalvesL Offline
          Luís Gonçalves
          last edited by Luís Gonçalves

          @Alan-Kilborn said in Insert new line after every comma, colon AND period mark:

          @Luís-Gonçalves said in Insert new line after every comma, colon AND period mark:

          I want to make a change in a text I have in which after every comma, colon, AND period mark a new line is inserted; but I want to do all of this at the same time, with a single regular expression. Is it possible?

          Find: [,:.]
          Replace: \r\n
          Search mode: Regular expression

          Note: If you have “Windows files” which is most-typical, do not use \n without \r in front of it, when replacing. Otherwise, you may “corrupt” your data.

          The problem with that regex is that it deletes the commas, colons and period marks, which I don’t want to. I want to keep them as they are, while inserting a new line after them.

          Alan KilbornA 1 Reply Last reply Reply Quote 0
          • Alan KilbornA Offline
            Alan Kilborn @Luís Gonçalves
            last edited by Alan Kilborn

            @Luís-Gonçalves said in Insert new line after every comma, colon AND period mark:

            The problem with that regex is that it deletes the commas, colons and period marks, which I don’t want to. I want to keep them as they are, while inserting a new line after them.

            Ah, I missed that detail.

            Revise the Replace: $0\r\n

            1 Reply Last reply Reply Quote 2

            Hello! It looks like you're interested in this conversation, but you don't have an account yet.

            Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

            With your input, this post could be even better 💗

            Register Login
            • First post
              Last post
            The Community of users of the Notepad++ text editor.
            Powered by NodeBB | Contributors