Erase the Space Before a Decimal and Add a Comma



  • 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 :)



  • 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



  • @Marie-Palmquist I found the solution!

    In the replace field I added ,/n



  • @astrosofista Thanks a million!


Log in to reply