I need a regular expression for python 2.7 that checks if a given word consists only of the letters 'a', 'b', 'r', 'e', 'd'. Please Help!
I tried the following code:
text = raw_input ('Enter Text:')
result = re.match(r'[abred]+', text)
if result:
print ('Match')
else :
print ("Doesn't Match")
However, for example by inputting "aaaq" it counts it as a matching text.