MartinR wrote
Surely
/^[atgcATGC]+$/
.....
The highlighted section implies that a pipe within brackets is a pipe character, not a special character.
Agreed (thanks for the correction)
/^[atgcATGC]+$/
is the correct form.
In both C (POSIX, which
man regex references) and PHP (PRCE) the pipe
| only operates as a logical OR in a capture
( )". e.g.:-
/^([atgc]|[ATGC]+)$/
(which is longer and adds no advantages)
NOTE: PCRE is the regex used by PHP, it's has more functions and some differences from the Posix regex used in C (and confusingly, in Perl)
http://php.net/manual/en/reference.pcre.pattern.posix.php