• Login
Community
  • Login

How do I find, multiply and replace a number in notepad++?

Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
3 Posts 2 Posters 1.7k 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.
  • I
    IVIemories
    last edited by Apr 16, 2019, 11:40 PM

    I’m trying find all exp values in a file and multiplying them by two using the find and replace function, so something like

    exp=“2” to exp=“4”
    exp=“3” to exp=“6”
    exp=“4” to exp=“8”
    I can select all the exp values using exp=“(.*)” but I can’t seem to find a way to multiply the wildcard value. exp=“2($1)” just adds a 2 to the front of the wildcard so it ends up as exp=“22” so does anyone know how I can multiply the numbers correctly?

    Apologies if I’m missing something really obvious here.

    1 Reply Last reply Reply Quote 0
    • T
      Terry R
      last edited by Apr 17, 2019, 12:08 AM

      @IVIemories said:

      multiplying them by two

      The find and replace function (using regular expressions) will not perform any mathematical calculations. Depending on how many different numbers there are you could do simple substitution. The expression can get a bit long winded though.

      Another option would be to use one of the supported programming languages through NPP, one is Python Script, however this will require learning it first, again a long winded process.

      Third option is to parse it through something like Excel which could do the multiply, again it will take some effort.

      Terry

      1 Reply Last reply Reply Quote 3
      • I
        IVIemories
        last edited by Apr 17, 2019, 2:40 AM

        Darn, that’s a bit annoying; but at least I know throwing different brackets at the replace line won’t do anything now.

        Appreciate the help!

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