Navigation

    Community

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

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

    Help wanted · · · – – – · · ·
    2
    3
    18
    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 Jones
      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 Kilborn 1 Reply Last reply Reply Quote 0
      • Alan Kilborn
        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 Jones 1 Reply Last reply Reply Quote 3
        • Jonathan Jones
          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
          • First post
            Last post
          Copyright © 2014 NodeBB Forums | Contributors