Your RE "^[(rR)|(yY)|(aA)|(nN)]{5}$/" will never never never give a matching in any string on earth and elsewhere, I think, because of the '/' character after '$'
See the results of the RE without this '/':
import re
pat = re.compile("^[(rR)|(yY)|(aA)|(nN)]{5}$")
for ch in ('arrrN','Aar)N','()|Ny','NNNNN',
'marrrN','12Aar)NUUU','NNNNN!'):
print ch.ljust(15),pat.search(ch)
result
arrrN <_sre.SRE_Match object at 0x011C8EC8>
Aar)N <_sre.SRE_Match object at 0x011C8EC8>
()|Ny <_sre.SRE_Match object at 0x011C8EC8>
NNNNN <_sre.SRE_Match object at 0x011C8EC8>
marrrN None
12Aar)NUUU None
NNNNN! None
My advice: think of [.....] in a RE as representing ONE character at ONE position. So every character that is between the brackets is one of the options of represented character.
Moreover, as said by Adrien Plisson, between brackets [......] a lot of special characters lost their speciality. Hence '(', ')','|' don't define group and OR, they represent just these characters as some of the options along with the letters 'aArRyYnN'
.
"^[rRyYaAnN]{1,5}$" will match only strings as 'r',ar','YNa','YYnA','Nanny'
If you want to match the same words anywhere in a text, you will need "[rRyYaAnN]{1,5}"