• Login
Community
  • Login

How can i bulk change this

Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
5 Posts 2 Posters 407 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
    Michael Vv
    last edited by Mar 9, 2023, 10:12 PM

    Hi, i have this section that repeats throught the file: <my_score>2</my_score>
    i want to change the number that is in the middle to a 0. How can i do that

    P 1 Reply Last reply Mar 9, 2023, 10:15 PM Reply Quote 0
    • P
      PeterJones @Michael Vv
      last edited by Mar 9, 2023, 10:15 PM

      @Michael-Vv said in How can i bulk change this:

      <my_score>2</my_score>

      As stated, it’s quite simple

      FIND = <my_score>2</my_score>
      REPLACE = <my_score>0</my_score>

      If you want a different answer, then you’d better ask again, with more details.

      ----

      Useful References

      • Please Read Before Posting
      • Template for Search/Replace Questions
      • Formatting Forum Posts
      • Notepad++ Online User Manual: Searching/Regex
      • FAQ: Where to find other regular expressions (regex) documentation
      M 1 Reply Last reply Mar 9, 2023, 10:27 PM Reply Quote 4
      • M
        Michael Vv @PeterJones
        last edited by Mar 9, 2023, 10:27 PM

        @PeterJones not exactly what i wanted, but i managed anyway since the number in the middle only goes from 1 to 10. But if i had a greater range of numbers how would i do this?

        P 1 Reply Last reply Mar 9, 2023, 10:31 PM Reply Quote 0
        • P
          PeterJones @Michael Vv
          last edited by PeterJones Mar 9, 2023, 10:31 PM Mar 9, 2023, 10:31 PM

          @Michael-Vv ,

          I couldn’t tell from your original post whether it would be just the number that would be different (which I was guessing), or whether it would also be the tag text in some way. And whether other requirements would pop up as I kept giving answers. So I gave the most simplistic one, to try to convince you that you needed to provide actual information if you wanted a reasonable answer.

          Given you said “greater range of numbers”, then

          • FIND = <my_score>\d+</my_score>
          • REPLACE = <my_score>0</my_score>
          • SEARCH MODE = Regular Expression

          The \d means “any digit character”. And + means “one or more”. So it will match one or more digits, and replace them all with a single 0.

          M 1 Reply Last reply Mar 9, 2023, 10:32 PM Reply Quote 4
          • M
            Michael Vv @PeterJones
            last edited by Mar 9, 2023, 10:32 PM

            @PeterJones thanks man, you helped me a lot!

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