[Answered ]-Unable to match trailing slash after email address in url regex

2👍

The $ anchor means the end of string, and the first time you have it inside a consuming pattern, it requires the end of string there.

Thus, you need to remove the first $ in your pattern and use

^customer/(?P<customer_email>[\w.%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,63})/?$

See the regex demo.

Leave a comment