I want to write some urls in flask using regular expression. I have them in django like this
r'^v1/$'
r'^v1/(.+/)$'
I want to recreate them in flask
I have tried following
class RegexConverter(BaseConverter):
def __init__(self, url_map, *items):
super(RegexConverter, self).__init__(url_map)
self.regex = items[0]
app.url_map.converters['regex'] = RegexConverter
api.add_resource(Handler1,'/<regex("^v1/$")>')
api.add_resource(Handler2,'/<regex("^v1/(.+/)$")>')
But it's not working. Showing error
ValueError: malformed url rule: '/<regex("^v1/$")>'