Community
    • Login

    Insert new line after every comma, colon AND period mark

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    4 Posts 2 Posters 18.0k 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.
    • Luís GonçalvesL
      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
        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
          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
            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
            • First post
              Last post
            The Community of users of the Notepad++ text editor.
            Powered by NodeBB | Contributors