Skip to content

fix: Really correct the rest param regex#186

Merged
webJose merged 1 commit intomainfrom
JP/FixRestParam
Dec 11, 2025
Merged

fix: Really correct the rest param regex#186
webJose merged 1 commit intomainfrom
JP/FixRestParam

Conversation

@webJose
Copy link
Contributor

@webJose webJose commented Dec 11, 2025

Fixes #182.

@webJose webJose requested a review from Copilot December 11, 2025 18:21
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes issue #182 by correcting the regex pattern for rest parameters to properly handle empty matches. The updated pattern changes from (?<rest>\/.*) to (?<rest>(?:\/.*|$)), allowing rest parameters to match either a path segment or an empty string at the end of the pattern.

Key Changes:

  • Updated the rest parameter regex pattern to support empty matches using alternation with $ anchor
  • Added comprehensive test cases to verify the fix handles edge cases, including empty rest parameters and paths with similar text

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/lib/kernel/RouteHelper.svelte.ts Updated rest parameter regex to allow empty matches by adding `
src/lib/kernel/RouteHelper.svelte.test.ts Updated expected regex patterns and added new test cases for empty rest parameters and similar path text scenarios

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@webJose webJose merged commit 35017fc into main Dec 11, 2025
1 check passed
@webJose webJose deleted the JP/FixRestParam branch December 11, 2025 18:24
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

Successfully merging this pull request may close these issues.

RouterEngine route regex matches paths with similar names

2 participants