• Login
Community
  • Login

Erase the Space Before a Decimal and Add a Comma

Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
4 Posts 2 Posters 384 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.
  • M
    Marie Palmquist
    last edited by May 11, 2020, 10:07 PM

    Hi!

    I have the following line repeated in different variations in a document:

    009084, Ind - 34007 630.00

    I would like to add a comma and erase the space between 34007 and 630.00. The decimal number changes all over the document, so I after some research I found that (\d+.\d{1,2})\d* finds every single decimal number in my document.

    I am struggling with what to write on the replace field in order to erase the space between both numbers and place a comma.

    I truly appreciate any help you guys might be able to provide :)

    A M 2 Replies Last reply May 11, 2020, 11:20 PM Reply Quote 0
    • A
      astrosofista @Marie Palmquist
      last edited by May 11, 2020, 11:20 PM

      Hi @Marie-Palmquist

      If I understood the problem correctly, you want to replace the space between two those numbers with a comma. If this is the case, you could apply the following S/R regex:

      Search: (?-s)\d+,\sInd\s-\s\K(\d+)\s([\d.]+)
      Replace: $1,$2

      Put the caret at the very beginning of the document, select just the Regular Expressions mode and click on Replace All.

      Given the following data

      009084, Ind - 34007 630.00
      009084, Ind - 45632 123.98
      009084, Ind - 98764 334.83
      

      you will get this output:

      009084, Ind - 34007,630.00
      009084, Ind - 45632,123.98
      009084, Ind - 98764,334.83
      

      Hope this helps

      M 1 Reply Last reply May 11, 2020, 11:25 PM Reply Quote 3
      • M
        Marie Palmquist @Marie Palmquist
        last edited by May 11, 2020, 11:25 PM

        @Marie-Palmquist I found the solution!

        In the replace field I added ,/n

        1 Reply Last reply Reply Quote 0
        • M
          Marie Palmquist @astrosofista
          last edited by May 11, 2020, 11:25 PM

          @astrosofista Thanks a million!

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