Community
    • Login

    Simple replace / to hard for me

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

              worked! Thanks Claudia!

              1 Reply Last reply Reply Quote 0

              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