I want to match complete strings to a specific pattern. Let\'s say :
word = \"aaaa\" test = re.match(r\"^aaaa$\", word) # this returns True
Ho
You can use negative lookaheads for checking if it contains a new line character or not.In your case, ^aaaa(?!\n)$.
negative lookaheads
^aaaa(?!\n)$