2

Snapshot

I'm pretty sure my regex is correct, but somehow it cannot capture the parameter and complaining no page found/match... I'm really stuck, if anyone can help me anything...heap thanks

This is the related part of my urls.py

from django.conf.urls import *
from django.conf.urls.static import static
from api.views.forgot_password import password_reset

url(r'^reset_password/(?P<auth>\w+)/(?P<email>\w+)/$', password_reset),

1 Answer 1

2

(?P<email>\w+) part is incorrect. \w match only digits, _, alphabets (not @, .).

Use following url:

`^reset_password/(?P<auth>\w+)/(?P<email>[^/]+)/$`

This does not strictly match email. But that will not be issue because you should check email with User.email.

Sign up to request clarification or add additional context in comments.

3 Comments

Ok, I understand now... the regex is wrong after all lol... Heap thanks for mentioning that...I'll accept your answer happily:)
@Romans8.38-39, Some email could contain %, +, -, ...; I updated the url again.
yes, you're right... I'm not really good at regex :( Many thanks falsetru:)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.