Hello
I am trying to use regular expressions in a java program. I would like the regex to identify a String of unknown length and whose charachters are only \'C\', \'A\', \'G\'
I disagree with the most voted answer. With [ACGT]+, a large string will lead to a lot of memory usage. So I would use a negated regex instead, and check if the string doesn't contain non [ACGT] characters instead: