Repository navigation
feat(router): match regex routes with nitely regex - #336
Open
eveeifyeve wants to merge 2 commits into
Open
eveeifyeve wants to merge 2 commits into
eveeifyeve wants to merge 2 commits into
Conversation
std/re binds PCRE1 (EOL) through std/pcre. Regex route patterns now use nitely regex (pure Nim): the router accepts re2"..." literals and findRe() fills the capture array, keeping the std/re find() contract (start index or -1, matches[i] = group i+1).
The router imports nitely regex since moving off std/re; the nimble file must say so. Regex2 (the API the router uses) ships in regex >= 0.21.0.
dom96
requested changes
Oct 23, 2026
| expectKind(pattern[0], nnkIdent) | ||
| case ($pattern[0]).normalize | ||
| of "re": return MRegex | ||
| of "re2": return MRegex |
Owner
There was a problem hiding this comment.
Curious about why you're changing this
Author
There was a problem hiding this comment.
std/re in nim is deprecated due to using pcre1 and it's recommended to use nitely regex which uses re2. See nim-lang/Nim@8b44b9d for more info.
Owner
There was a problem hiding this comment.
The tests in the Nim repo seem to be using re? nim-lang/Nim@8b44b9d#diff-989d8bad1e3bb5c10c2f1239a5eee1a4196ca3eca2d19ceb711640d1b7500d0cR16
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
std/re binds PCRE1 (EOL) through std/pcre. Regex route patterns now
use nitely regex (pure Nim): the router accepts re2"..." literals
and findRe() fills the capture array, keeping the std/re find()
contract (start index or -1, matches[i] = group i+1).