Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7771749
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T16:43:35+00:00 2026-06-01T16:43:35+00:00

In the python docs for regex there is the description of what the .

  • 0

In the python docs for regex there is the description of what the “.” does:

(Dot.) In the default mode, this matches any character except a
newline. If the DOTALL flag has been specified, this matches any
character including a newline.

For a project i do in Django i set up this regex:

url(r'^accounts/confirm/(.+)$', confirm,name='confirmation_view')

For all i understand, this should match any url that starts with ‘accounts/confirm/’, then followed by any number of arbitrary characters. These arbitrary characters are then passed to the function “confirm” as parameter. So far, so good.

So this regex should match

accounts/confirm/fb75c6529af9246e4e048d8a4298882909dc03ee0/

just as well as

accounts/confirm/fb75c6529af9246e4e-048d8a4298882909dc03ee0/

and

accounts/confirm/fb75c6529af9246e4e=048d8a4298882909dc03ee0/

and

accounts/confirm/fb75c6529af9246e4e%20048d8a4298882909dc03ee0/

That, at least, was what i thought it would do. But it doesn’t, it matches only the first one. Django keeps returning me a 404 on the other ones. Which i do not understand, because the (.+) part of the expression should mean “match one ore more of any character except a newline”.

edit:
As the comments and answers proved, i got the regex right. So this is now a question about: why is Django not returning the correct view, but a 404. Is it doing some stuff to the url before passing it to that regex?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T16:43:37+00:00Added an answer on June 1, 2026 at 4:43 pm

    A quick test confirms this should work:

    >>>import re
    >>>test = ["accounts/confirm/fb75c6529af9246e4e048d8a4298882909dc03ee0/", "accounts/confirm/fb75c6529af9246e4e-048d8a4298882909dc03ee0/", "accounts/confirm/fb75c6529af9246e4e=048d8a4298882909dc03ee0/", "accounts/confirm/fb75c6529af9246e4e%20048d8a4298882909dc03ee0/"]
    >>>all([re.match(r'^accounts/confirm/(.+)$', item) for item in test])
    True
    

    This will return false on any non matches:

    >>>test.append("something else")
    >>>all([re.match(r'^accounts/confirm/(.+)$', item) for item in test])
    False
    

    The problem must be elsewhere.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The Python docs say: re.MULTILINE: When specified, the pattern character '^' matches at the
I was reading the Python docs about classes and came across this paragraph which
The entry for sys.path[0] is '/usr/lib/python2.7/dist-packages/wx-2.8-gtk2-unicode' . The Python docs say this should be
In Python compiled regex patterns have a findall method that does the following: Return
The python docs gives this code as the reverse operation of zip: >>> x2,
From Python docs: http://docs.python.org/library/stdtypes.html#comparisons Implementation note: Objects of different types except numbers are ordered
From Python docs: sys.excepthook(type, value, traceback) This function prints out a given traceback and
I don't understand the following part of the Python docs: http://docs.python.org/reference/expressions.html#slicings Is this referring
I'm modifying Python code that have this form: def foo(self): try: connect socket except
I have one question about sys.setrecursionlimit() From the python docs this function: Set the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.