• Login
Community
  • Login

Need help search and replace with wildcards

Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
3 Posts 2 Posters 1.2k 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.
  • P
    Patrick Huebgen6
    last edited by Oct 8, 2018, 10:33 PM

    Need to replace , with . in a json file but only for certain lines
    I have many lines that look like this
    , “VALSUM”:“92,55964588409961”

    	, "VALSUM":",25"
    
    	, "VALSUM":"9266,34657"
    

    and only should replace lines that contain VALSUM all other lines with comma should stay untouched
    I was hoping to solve it with regex
    “VALSUM”:“\d*,\d*” seems to work so I find the line but replace
    “VALSUM”:“\d*.\d*” does not work
    Please help
    Paul

    1 Reply Last reply Reply Quote 1
    • T
      Terry R
      last edited by Oct 8, 2018, 11:29 PM

      @Patrick-Huebgen6
      Good attempt. As you say your find regex worked. Unfortunately you cannot use the same type of information in the replace string.

      May I suggest you read
      https://notepad-plus-plus.org/community/topic/15765/faq-desk-where-to-find-regex-documentation
      for good documentation on how a regex works. I have tried looking for good information on the replace field, but most concentrate on the Find field so you might need to look quite hard. If I find one i will post back.

      In the meantime use the following:
      Find What:(VALSUM":"\d*),(\d*)
      Replace with:\1\.\2

      You will see I put brackets around 2 groups in the find window. These are referenced by \1 and \2 in the replace window. As the “.” is special I had to put a ‘delimiter’ before it so that it’s recognised as being the “.” character. I tested it

      See if that helps you.

      Terry

      1 Reply Last reply Reply Quote 3
      • P
        Patrick Huebgen6
        last edited by Oct 9, 2018, 8:53 AM

        Thank you - worked perfect!

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