Community
    • Login

    Searching a file for numbers with a specific number of digits.

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    6 Posts 5 Posters 2.9k Views 1 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.
    • Jonathan JonesJ Offline
      Jonathan Jones
      last edited by

      I’m looking to find a way to search a file for a specific string, follow by specific number of wildcard digits. I have tried \d but I don’t believe I am using it for its intended purpose. I would ideally do this using the Find functionality.

      Example: “Serial Number: #####”

      Alan KilbornA 1 Reply Last reply Reply Quote 0
      • Alan KilbornA Offline
        Alan Kilborn @Jonathan Jones
        last edited by Alan Kilborn

        @Jonathan-Jones

        Serial Number: \d{5} would search for 5 digits. You’d want to set your search mode to regular expression.

        If you want exactly 5, and not 6, you might want to change it to Serial Number: \d{5}(?!\d) which means 5 digits followed by something that is not a digit.

        Jonathan JonesJ logi techL 2 Replies Last reply Reply Quote 3
        • Jonathan JonesJ Offline
          Jonathan Jones @Alan Kilborn
          last edited by

          @Alan-Kilborn said in Searching a file for numbers with a specific number of digits.:

          \d{5}(?!\d)

          Thank you! The combination of string followed by \d{5}(?!\d) gave me exactly what I wanted!

          1 Reply Last reply Reply Quote 1
          • logi techL Offline
            logi tech @Alan Kilborn
            last edited by

            @Alan-Kilborn

            What If I wanted to search for a specific number for example : 3XXXXX5849
            XXX are digit numbers
            thanks for help in advance.

            gerdb42G Mark OlsonM 2 Replies Last reply Reply Quote -1
            • gerdb42G Offline
              gerdb42 @logi tech
              last edited by

              @logi-tech

              Well, then search for 3\d{5}5849. This regex isn’t much of rocket science, just have a look at https://community.notepad-plus-plus.org/topic/15765/faq-where-to-find-regular-expressions-regex-documentation

              1 Reply Last reply Reply Quote 0
              • Mark OlsonM Offline
                Mark Olson @logi tech
                last edited by

                logi-tech said:

                What If I wanted to search for a specific number for example : 3XXXXX5849

                This user has asked the same question three times in three different threads. At this point, I’m pretty sure they’re a bot fishing for upvotes.

                We should stop dignifying them with replies until they prove they’re human.

                1 Reply Last reply Reply Quote 2

                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