2

Is it possible to write a pattern like:

.get('/:pattern' ...

which matches only 6 symbols hashes? How can I get this hash inside handler function? Example of a hash: mBe8s0

kharandziuk
  • 12,020
  • 17
  • 63
  • 121
  • possible duplicate of [Regex for route matching in Express](http://stackoverflow.com/questions/10858005/regex-for-route-matching-in-express) – Claudio Bredfeldt Aug 31 '15 at 11:23

1 Answers1

3
app.get('/:pattern([A-Za-z0-9]{5}$)', function (req, res){
    res.send(req.params.pattern);
});
Hiren S.
  • 2,793
  • 15
  • 25