mercredi 8 février 2017

Match word to pattern

I am trying to decrypt some text and thought writing a python script would help. The way the text is encrypted is that every letter maps to a letter in the alphabet. I want to try to match large words to an English word list, because I think they have very few possibilities.

My question is, how do I check if a word matches a pattern like ABCB. So the first three letters are different, but the last letter is the same as the fourth. Were would be a possibility here. I tried using a regex, but I can't come up with a regex that does this for a word of length n. Does anybody have suggestions? Thanks to everyone who spends time helping me.

Aucun commentaire:

Enregistrer un commentaire