Your requirement is not very clear so I am giving you several alternatives, which I hope one of them fits your need.
If you want to select lines containing 6 consecutive digits and no other digits, you can use
^\D*\d{6}\D*$
^ start of line
\D* some optional non-digit,
\d{6} followed by 6 digits,
\D* followed by some optional non-digit
$ till end of line
If you want to select lines containing 6 digits (not necessary to be consecutive), you can use this
^(\D*\d){6}\D*$
^ start of line
(\D*\d) group of optional non-digit then 1 digit
{6} above group happening for 6 times
(i.e. 6 digits in total)
\D*$ follow by non-digits till end of line
If you want to select lines containing a sequence of exactly 6 digits, you can
^.*(\b|\D)\d{6}(\b|\D).*$
^.* start of line, followed by some chars
(\b|\D) followed word boundary or non-digit
\d{6} 6 digits
(\b|\D) followed word boundary or non-digit
.*$ followed by some chars till end of line
Update:
With info from @WiktorStribiżew, Notepad++ may be handling \D
in unexpected way as it may match newlines. You can simply replace the \D
in above regex to [^0-9\n\r]
for preferred behavior.