Since I am learning Javascript and Express.js at the same time I was experimenting around with regular expressions when making a get request
To familiaries my self w
JavaScript does not support possessive quantifiers. The error you are seeing occurs because the +
can only be used as a greedy one-or-more quantifier.
The chart you reference is from Oracle, and is explaining the quantifiers supported by Java, not JavaScript.
You don't need to resort to anything special to do the kind of matching you want.
If you want to match "a string ending in a /
, with no other slashes in it, you can use:
/[^/]+\/$/
One or more non-slashes, followed by a slash, followed by the end of the string.