Colons in routes


Not sure if this is a bug or me missing something, but I can’t get my routes with colons to work with newer versions of Sanic, while it used to work fine before.

See example:

from sanic import Sanic
from sanic.response import text

app = Sanic("MyHelloWorldApp")

async def hello_world(request):
    return text("Hello, world.")

This route is never matched.

Before you tell me, I know this is bad URL design, but it’s not up to me anyway.

Is there any way I can get the old router behaviour back ?

Thank you,

You’ll need to use a custom matcher with a regex. (scroll down a bit to the regex section)

Thanks you, with your help I was able to fix this. It ain’t pretty but it works.