4 AnswersNew Answer
in your pattern just add a ".*" before gmailcom so it would give something like this : pattern = r".*gmailcom$" . is what is called a meta character and it stands for any symbol except new lines and some other special things... the *symbol means that there might ne any number of . character in the string. (you could have used + instead of * but i would have mean at least one "."). In reality the regex match verify the match from the beginning of a string that's why you have tp specify what is there at the begining of your string. anothet solution is to use the search function because the $ symbol is gonna say that you only check the pattern at the end of the string.
I'd double check with the regex definitions (I don't remember the details offhand): Do you need a wildcard, or other pattern, to allow for the early part of the string? Sorry I can't be more specific, but there are different matching conventions, and the details are eluding me right now.
If you replace re.match with re.search it works, but is that what you want?
@Paul @Glozi30 I had just read about python metacharacters and wanted to try something with $. I forgot that I also had to write something about the beginning(if using "match"), as it was in the tutorial. Thanks for defining the starting of expression, and I used match just because the tutorial did it without problem, and my code caused a problem, I can also use search.