Comments (12)
@jonathanong How about adding support for various regexp-style modifiers (+
for more than one part, *
for zero or more and ?
for optional)? The plus style sounds like what you're after here.
from path-to-regexp.
oh that makes sense. i think of *
as just "anything, i don't care" not a regexp wildcard when defining routes though.
from path-to-regexp.
In my refactor I removed the ability to use an asterisk like that in favour of just using a regexp - (.*)
- since that was what it did anyway internally.
from path-to-regexp.
Anyway, if you're on board with it - I can add the ability tonight and get everything tested.
from path-to-regexp.
i thought (.*)
just checked the current fragment. i'd like file
to be something like lib/index.js
or something.
from path-to-regexp.
Well, *
was always replaced with (.*)
- there was never any understanding of fragments. If you wanted file to match that, you could use /:file(.+)
or with this change /:file+
.
from path-to-regexp.
ohhhh this changes everything!
from path-to-regexp.
Haha, is that good or bad?
from path-to-regexp.
good. if that's the case, we might as well remove *
support outside of regexps. it doesn't add much, and (.*)
is much more explicit. didn't realize that. not sure how many conversations i confused you with this.
from path-to-regexp.
Awesome! Don't worry about it, at least we got to it eventually. I'll implement this tonight, add some more test cases and documentation and we should be ready to go. Then, I'll look at adding the feature the guy was after in path-match
and the changes will cascade through.
from path-to-regexp.
@jonathanong https://github.com/component/path-to-regexp/pull/28 - just need to update the keys array later with the syntax to denote these matches.
from path-to-regexp.
Supported using +
param suffix.
from path-to-regexp.
Related Issues (20)
- Double decoding path parameters HOT 17
- Publish to NPM HOT 1
- Next dynamic route with spread (...) throws 'Unexpected MODIFIER at 70, expected END' HOT 2
- end option does not work as expected HOT 2
- When parsed to tokens, why are backslashes stripped from pattern? HOT 2
- Invalid regex patterns not properly detected. HOT 2
- Another dumb question: How to run tests? HOT 2
- Erroneous test result. HOT 3
- `?` in optional capture group isn't connected to group in output - named param HOT 11
- SyntaxError: Invalid regular expression: invalid group specifier name HOT 1
- The validate config in options is not work in compile function. HOT 1
- throw new TypeError(`Unexpected ${nextType} at ${index}, expected ${type}`) HOT 3
- How about match an empty array? HOT 2
- Regex for non-negative integers only matches two or more digits HOT 1
- Return the matched path/regex
- Escaping the question mark for a query string throws and error HOT 2
- Checking if a path is a subset of another path HOT 1
- params are being joined without `/` HOT 1
- Issue with converted value used in Next.js rewrite HOT 3
- Contributing named capture groups to pathToRegexp HOT 10
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from path-to-regexp.