Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

space in path regex not working #2572

Closed
chesstrian opened this issue Feb 28, 2015 · 2 comments
Closed

space in path regex not working #2572

chesstrian opened this issue Feb 28, 2015 · 2 comments
Assignees
Labels

Comments

@chesstrian
Copy link

Hi guys,

I have this route:

router.get('/service/:parameter([a-z\\d-. ]+)', function(req, res) {
  res.json({param: req.params.parameter});
});

My problem is when I try in the browser something with space in parameter, I get 404. Anything else works. I tried using \\s instead of space.

Any help will be appreciate.

@dougwilson
Copy link
Contributor

Regular expressions match on the URL and since it is impossible to have a space in your URL, it will never match. You have to match against %20.

Basically a duplicate of #2511

@chesstrian
Copy link
Author

Thanks @dougwilson 👍

@dougwilson dougwilson self-assigned this Mar 1, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants