Community
    • Login

    Erase the Space Before a Decimal and Add a Comma

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    4 Posts 2 Posters 656 Views 1 Watching
    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.
    • Marie PalmquistM Offline
      Marie Palmquist
      last edited by

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

      astrosofistaA Marie PalmquistM 2 Replies Last reply Reply Quote 0
      • astrosofistaA Offline
        astrosofista @Marie Palmquist
        last edited by

        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 PalmquistM 1 Reply Last reply Reply Quote 3
        • Marie PalmquistM Offline
          Marie Palmquist @Marie Palmquist
          last edited by

          @Marie-Palmquist I found the solution!

          In the replace field I added ,/n

          1 Reply Last reply Reply Quote 0
          • Marie PalmquistM Offline
            Marie Palmquist @astrosofista
            last edited by

            @astrosofista Thanks a million!

            1 Reply Last reply Reply Quote 1

            Hello! It looks like you're interested in this conversation, but you don't have an account yet.

            Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

            With your input, this post could be even better 💗

            Register Login
            • First post
              Last post
            The Community of users of the Notepad++ text editor.
            Powered by NodeBB | Contributors