Is it better to use path() or url() in urls.py for django 2.0? : <p>In a django online course, the instructor has us use the <code>url()</code> function to call views and utilize regular expressions in the urlpatterns list. I've seen other examples on youtube of this.
e.g.</p>

<pre><code>from django.contrib import admin
from django.urls import include
from django.conf.urls import url

urlpatterns = [
    path('admin/', admin.site.urls),
    url(r'^polls/', include('polls.urls')),
]


#and in polls/urls.py

urlpatterns = [        
    url(r'^$', views.index, name="index"),
]
</code></pre>

<p>However, in going through the Django tutorial, they use <code>path()</code> instead e.g.:</p>

<pre><code>from django.urls import path
from . import views

urlpatterns = [
    path('', views.index, name="index"),        
]
</code></pre>

<p>Furthermore regular expressions don't seem to work with the <code>path()</code> function as using a <code>path(r'^$', views.index, name="index")</code> won't find the <code>mysite.com/polls/</code> view. </p>

<p>Is using <code>path()</code> without regex matching the proper way going forward? Is <code>url()</code> more powerful but more complicated so they're using <code>path()</code> to start us out with? Or is it a case of different tools for different jobs?</p>
