The exclusion trick: \w and [^\W] match exactly the same thing, so to match a \w but not a \d, just use [^\W\d]
#!/usr/bin/perl use strict; # https://perlmonks.org/?node_id=11122003 use warnings; my $text = "John P5ete Andrew Richard58 Nic4k Le7on5"; my @names = $text =~ /\b[^\W\d]*\d[^\W\d]*\b/g; print "@names\n";
Outputs:
P5ete Nic4k
In reply to Re: regex search for words with one digit
by tybalt89
in thread regex search for words with one digit
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |