I have this to get input and put it in a list:
def start(): move_order=[raw_input("Enter your moves: ").split()]
And I only want the characters A, D, S, C, H (it's for a game >_>) to be allowed. I've tried using the regular expressions stuff:
if re.match('[ADSCH]+', [move_order]) is False: print "That's not a proper move!" return start()
...in different forms...
string_test=re.compile('[ADSCH]+') if string_test.match(move_order]) is False: print "That's not a proper move!" return start()
Aaaaand can't get it to work. I'm definitely doing something wrong within those code blocks, I tried to figure it out, but it's not working. Learning what I'm doing wrong would be nice, but the solution to my problem would teach me a lot more I feel like. I might not even need to use re, but it seemed to me that that was a space efficient way to accomplish what I want. My immediate problem I think is that I don't know how to get the re to use lists (unless (certainly) there's other glaring problems trained eyes can find).
I'll go ahead and ask since I'll probably screw this up too, but I also need to have it make sure that a C is never after an H... but a tiny hint for that would be acceptable because I like figuring things out.