Skip to content

Instantly share code, notes, and snippets.

@gamorales
Created February 27, 2020 18:50
Show Gist options
  • Save gamorales/faa78aa848798ad9e001380e987cace8 to your computer and use it in GitHub Desktop.
Save gamorales/faa78aa848798ad9e001380e987cace8 to your computer and use it in GitHub Desktop.
Find if a word is an anagram of other.
import re
def anagram(a, b):
regex = f"^(?!.*(.).*\1)[{a}]*$"
if re.search(regex, b, flags=re.IGNORECASE):
return True
return False
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment