Navigation

    Community

    • Login
    • Search
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search

    Simple replace / to hard for me

    Help wanted · · · – – – · · ·
    2
    5
    2862
    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 Holliger
      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 Frank 1 Reply Last reply Reply Quote 0
      • Claudia Frank
        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 Holliger
          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 Frank 1 Reply Last reply Reply Quote 0
          • Claudia Frank
            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 Holliger
              Sascha Holliger last edited by

              worked! Thanks Claudia!

              1 Reply Last reply Reply Quote 0
              • First post
                Last post
              Copyright © 2014 NodeBB Forums | Contributors