Similar Django url patterns matches wrong one

It might be a regex issue or rule I'm not familiar with but I essentially have these 2 urls

(r'quote', quote),
(r'email/quote/$', sendQuote),

But when I go to mydomain.com/email/quote it keeps getting caught by the first one. Is there something I'm doing wrong?

Answers


You need to specify the start of the regex using the ^ character. Similar to how $ specifies that it's the end of the regex, ^ will say that it's the start.

(r'^quote/$', quote),
(r'^email/quote/$', sendQuote),

Need Your Help

Finding whether 2 BST represented by arrays are isomorphic or not

algorithm tree binary-search-tree

1) Given 2 arrays containing elements of a complete Binary tree(level by level), without actually reconstructing a tree(i.e. by only doing swaps in an array), how can I find whether those 2 arrays ...

c# do the equivalent of restarting a Task with some parameter

c# parallel-processing task

The main idea here is to fetch some data from somewhere, when it's fetched start writing it, and then prepare the next batch of data to be written, while waiting for the previous write to be comple...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.