Using Raku (formerly known as Perl_6)
~$ raku -e 'for lines() {my %h; for .words.[0].comb() { %h{$_}++ }; \
.put if %h.keys.contains( "R" & "E" & "G" & "X") && %h<E> >= 2 };' file
Sample Input:
NGNAEAREAX EAHVSELYCI FNWGNLACQM AWKLRMDHIT PRYMFNYMVM
NCNREDEEEQ EAHVSELYCI FNWGNLACQM AWKLRMDHIT PRYMFNYMVM
Sample Output:
NGNAEAREAX EAHVSELYCI FNWGNLACQM AWKLRMDHIT PRYMFNYMVM
Raku is a programming language in the Perl-family. The problem as posted really seems to be a key/value problem, for which Raku is well suited (notice: no regex in the solution).
Briefly, lines are read-in, each line is broken on whitespace with words, and the first word [0] is taken. This first word is combed into individual letters.
From this point each letter is fed into the (previously declared) %h hash, whereupon the letter (represented by topic variable $_) immediately becomes a unique key in the hash, with a value determined by the number of times that key has been seen (hence the %h{$_}++ plus-plus).
Returning the %h hash at this point in the code ( using say %h.sort ), you would see the following:
(A => 3 E => 2 G => 1 N => 2 R => 1 X => 1)
(C => 1 D => 1 E => 4 N => 2 Q => 1 R => 1)
The final statement of the code solution at top demands that the %h hash contains each letter "R" & "E" & "G" & "X" as keys, and also that the value of the hash's "E" key is >= 2. If found, the entire line is returned (.put being short for $_.put, wherein $_ represents the input line).
https://docs.raku.org/language/hashmap
https://perlgeek.de/blog-en/perl-5-to-6/08-junctions.html
https://raku.org