urls.py - Why use regular expressions?

I can find lots of tutorials and forum answers explaining how to do this, but I have yet to find an explanation of what issue it solves (?)

To put it in perspective, I have a bunch of colleagues who have been using Django for years and they have never used them. But they are scientists writing small, simple applications…whereas I am a developer building management information systems and my smallest application is going to be bigger and more complex than anything they have ever attempted.

The reasons for asking are simply whether it’s something I can leave until I need it, or something I should be aiming to use right from the start.

I would consider it pretty much an artifact of how urls used to be defined, although they still have their uses.

The first paragraph in the Using regular expressions section of the docs explains it pretty well.

But to address your question, I’d say “Yes, it’s something you can ignore until you find a situation where you need it.”

Personally, I haven’t needed them since the addition of the Path converters for URLs (Django 2.0).

1 Like

Thanks, that’s good to know.