Community

    • Login
    • Search
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search

    Insert new line after every comma, colon AND period mark

    Help wanted · · · – – – · · ·
    2
    4
    148
    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çalves
      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 Kilborn 1 Reply Last reply Reply Quote 1
      • Alan Kilborn
        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çalves
          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 Kilborn 1 Reply Last reply Reply Quote 0
          • Alan Kilborn
            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
            Copyright © 2014 NodeBB Forums | Contributors