[FIX] ISSUE138: S10 shouldn't match S1/:context: #149
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The regex used for OPTIONAL SLASH is too general for some cases like S1/:context:. The slash between '1' and ':' shouldn't be optional because there's no REQUIRED SLASH or QUERY after it.
In the fix, I distinguish between the OPTIONAL SLASH and the conditionally optional slash. Only when the optional slash is before a REQUIRED SLASH or around a QUERY (either optional or required) string or followed by a static slash, it's then optional. Otherwise it's called the conditionally optional. Conditional means that it's required unless it's at the beginning or end of the pattern.
I also added tests to the match spec.
Best regards,
Jiawei