Skip to content

fix: error when regex is invalid#65

Merged
kevinccbsg merged 1 commit into
mainfrom
fix/regex-errors
Oct 23, 2025
Merged

fix: error when regex is invalid#65
kevinccbsg merged 1 commit into
mainfrom
fix/regex-errors

Conversation

@kevinccbsg

@kevinccbsg kevinccbsg commented Oct 23, 2025

Copy link
Copy Markdown
Member

This pull request improves the robustness of the findRule utility by adding validation for regular expressions and updating its tests to handle invalid regex patterns gracefully. The most important changes are:

Robustness improvements

  • Added a validRegex helper function in src/cli/utils/findRule.js to check if a given regex pattern is valid before using it.
  • Updated the findRule function to only attempt regex matching if the pattern is a valid regex, preventing runtime errors from invalid patterns.

Testing enhancements

  • Added a new test case in src/tests/cli/findRule.spec.js to ensure that findRule does not throw an error when encountering an invalid regex pattern in the rules.

This closes #63

@kevinccbsg kevinccbsg merged commit dba0cdf into main Oct 23, 2025
4 checks passed
@kevinccbsg kevinccbsg deleted the fix/regex-errors branch October 23, 2025 20:15
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.

[intercept] regex errors

1 participant