

Unfortunately, when the regex engine reaches the second number 13, the first numbers 46 and 99 are over ! A second click on the Find next button would not find anything else, although the numbers 46 and 99 are, obviously, duplicate numbers. It, first, matches from the number 13, in the first line till the second number 13 in the second line. Now let’s imagine we apply our regex (?s)(\d+).+\1, against the bunch of numbers, below : 27 13 00 46 55 For instance, the regex (?s).+ would match all the contents of a file, as they were, all, in a single line ! So, as the location of the two numbers may occur on different lines, I improved the regex to the form (?s)(\d+).+\1, by adding, the modifier (?s), which means that the dot character matches everything. Unfortunately, this regex can detect duplicate numbers on a same line, only, because the dot character does NOT match the End of Line characters ( as \r and \n ) I started with the simple regex (\d+).+\1. Keep the position of the regex engine scan, just after the last character of the first occurrence of the matched number, for later searches. Verify that, further on, in the current file, a second occurrence of that exact number does exist Match the first occurrence of a duplicated number I’m back to give you some explanations on the regex, in my previous post As I said in my precedent post, I’ll explain this regex, tomorrow, after a deserved rest ! It’s a bit late, by now, in France ( 04h05 ). Would, all, produce the result : Count: 7 matches, meaning that seven numbers are present two times, in each group ! Which could be written, as the unsorted list, below : 10 matches newline can be set or unset, without any change, too, on the resultįor instance, the following bunch of numbers, below : 10 14 13 8 1139 20 The 3 options Wrap around, Match case and.

The location of the cursor has no importance on the result number of matches So, be aware about additional text, which would NOT be part of your bunch of numbers ! Remember that the Count function run through all the contents of the current file. Type, in the Find what zone, the following regex (?s)\b(\d+)\b(?=.+\b\1\b)Ĭlick on the Count button, or hit the ALT + T shortcut Open the Find dialog, or use the CTRL + F shortcut

Paste your bunch of numbers, ONLY, in this new file ( it doesn’t matter how this list of numbers is displayed ) Open a new file, or use the CTRL + N shortcut Could you have numbers, present three times or more, in your bunch of numbers ? If NOT ( so your numbers occur once or twice, only ), I’ve got an nice solution that uses, again, a regex expression :
