[Solved] Regex finding duplicate numeric values in a text file


Try this:

\b(\d+)\b.*\b\1\b

It’ll find a number (thank’s to the word boundaries – \b – only whole numbers) and then match anything .* until the number is found again (\1 back reference). If the repeating one isn’t found it doesn’t match.

See it here at regex101.

Regards

4

solved Regex finding duplicate numeric values in a text file