Searching a file for numbers with a specific number of digits.
-
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: #####”
-
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. -
@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!
-
What If I wanted to search for a specific number for example : 3XXXXX5849
XXX are digit numbers
thanks for help in advance. -
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 -
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.