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

Using a space as deilimiter with end: false doesn't match paths that extend it #96

Closed
mees- opened this issue Nov 8, 2016 · 4 comments

Comments

@mees-
Copy link

mees- commented Nov 8, 2016

When creating a regex with pathToRegexp('test is', keys, { delimiter: ' ', end: false }) the regex doesn't match paths that extend it like: 'test is testing'

@blakeembrey
Copy link
Member

Thanks. The delimiter was only used for parsing the tokens, not for reconstructing the RegExp from tokens. I'll add it as an option there too. Out of interest, what are you using this for? I didn't expect someone to use it like this, that's for sure 😄

@mees-
Copy link
Author

mees- commented Nov 8, 2016

I was making a framework for bots for discord (a voice and chat service) and i was using path-to-regexp to match the chat messages, where it's weird to use anything other than spaces to distinguish between parts of the message

@blakeembrey
Copy link
Member

Ok. I'm not sure it'd work so great in that situation because you might have multiple spaces between words and other grammar, right?

@mees-
Copy link
Author

mees- commented Nov 8, 2016

that's possible, but i guess i can just filter out double spaces and the user will know they're talking to a bot so the commands would have to be written correctly

MUDev1994 pushed a commit to MUDev1994/path-to-regexp that referenced this issue May 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants