Apply regular expression for expressjs
I need to handle requests like this:
I wrote regexp that work in RegexPal
I create handler in Express.js
but it returns only last part of the key
req.params.key == '53538'
how can I retrieve full key?
The problem seems to be that you accidently capture the digits, and only the last capture is returned. Try either:
The only difference is that it allows leading and consecutive periods. If you know that will never be the case, or not a problem, then this regex is a lot easier to read.