import re
a ='''a is b because c'
re.search (r'* c. $', A)

I get an error like this when I want to judge by the number of characters from the back in a regular expression. What is wrong?

error: nothing to repeat at position 0
  • Answer # 1

    In regular expressions*Means "0 or more repetitions of the previous pattern".
    You wrote* c. $To*I get the error presented because there is nothing just before.

    after,..Is a metacharacter that means "any single character" (whether or not to include line breaks depends on the setting), so if you want to specify the dot itself\.Please write.