Process request parameters with regexp and use the resulting capturing group in the routes.
like express-params but works
properly in recent express releases where the use of app.param(fun)
has been
deprecated.
app = express()
capture = require('express-param-capture')
app.param('locale', capture(/([a-z]{2})_([A-Z]{2})/));
app.get('/:locale', function (req, res) {
res.status(200).send(req.params.locale[1] + ' - ' + req.params.locale[2]);
});