• Login
Community
  • Login

Adding commas

Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
3 Posts 2 Posters 18.7k 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.
  • Z
    Zhana Risley
    last edited by Jun 13, 2017, 2:39 PM

    I need to add comma to each line after a number. For example if I am working with these codes:
    38664
    38665
    44166
    44167
    32872
    32873
    173649
    I need an easy way to add a comma to each line where there is none. So end result should look like this:
    38664,
    38665,
    44166,
    44167,
    32872,
    32873,
    173649,
    I tried find and replace with no success since I do not have the original value and do not know how to mark the empty space.
    You assistance would be greatly appreciated.

    S 1 Reply Last reply Jun 13, 2017, 4:40 PM Reply Quote 0
    • S
      Scott Sumner @Zhana Risley
      last edited by Jun 13, 2017, 4:40 PM

      @Zhana-Risley

      Fairly straightforward IF your data is truly representatitve:

      Find-what box: (\d+)
      Replace-with box: \1,
      Search mode: ☑ Regular expression

      The explanation is:
      When finding, look for the longest contiguous run of digits–the \d means digits–the + means one or more–the ( ) will cause that digit run to be remembered for the replace. When replacing, replace each match with the original run of digits plus a comma.

      1 Reply Last reply Reply Quote 1
      • Z
        Zhana Risley
        last edited by Jun 13, 2017, 6:19 PM

        You are my new ‘Rock Star!’ That worked exactly like i needed it to!!! Thanks a million!

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