Community
    • Login

    Simple replace / to hard for me

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    5 Posts 2 Posters 3.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.
    • Sascha HolligerS
      Sascha Holliger
      last edited by

      Hi, can anyone please help me with this simple problem?

      in a file I need to search for numbers like this:

      *1234567890

      the numbers are always changing, but I need to get the Asterisk (*) removed.

      the replacement dosen’t need to be the same number, just the Asterisk need to be removed.

      so from this: *1234567890
      to this : 0000000000

      would be fine!

      Thanks if anyone can help!

      Regards, Sascha

      Claudia FrankC 1 Reply Last reply Reply Quote 0
      • Claudia FrankC
        Claudia Frank @Sascha Holliger
        last edited by Claudia Frank

        Hello @Sascha-Holliger,

        in replace dialog check regular expression.

        Find what:\*(\d+)
        Replace with:\1
        

        as * is a known char in regex we need to escape with \
        (\d+) = this matches any size of numbers and get stored in \1

        Cheers
        Claudia

        1 Reply Last reply Reply Quote 1
        • Sascha HolligerS
          Sascha Holliger
          last edited by

          Thanks, but it should only replace numbers with 10 digits… there are a lot of numbers in that file, only if the number has a leading * and is followed by 10 digits it should be replaced.

          Claudia FrankC 1 Reply Last reply Reply Quote 0
          • Claudia FrankC
            Claudia Frank @Sascha Holliger
            last edited by

            In find what replace the + with {10}

            \*(\d{10})
            

            Cheers
            Claudia

            1 Reply Last reply Reply Quote 1
            • Sascha HolligerS
              Sascha Holliger
              last edited by

              worked! Thanks Claudia!

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