Bug Description
The application throws an "Invalid regular expression: invalid group specifier name" error when processing certain regex patterns. This error occurs in JavaScript/TypeScript when using named capture groups or other regex features that may not be properly escaped or supported.
Affected Files
- src/lib/hooksManager.ts:133 - Where user-provided regex patterns are validated in the hooks configuration
- src/components/FloatingPromptInput.tsx:697-703 - Where file paths are escaped and used in RegExp constructors
Root Cause
The error typically occurs when:
- A regex pattern contains named capture groups using the syntax
(?<name>...)
- Special characters in file paths are not properly escaped before being used in RegExp constructors
- The regex pattern contains syntax that's not valid in JavaScript's RegExp implementation
Proposed Solution
- Add proper error handling around RegExp constructor calls
- Validate regex patterns before attempting to create RegExp objects
- Improve escaping of special characters in file paths
- Provide clear error messages to users when invalid regex patterns are encountered
Steps to Reproduce
- Configure a hook with a regex pattern containing named capture groups
- Or use a file path with special regex characters in the FloatingPromptInput component
- The error will be thrown when the RegExp constructor tries to parse the invalid pattern
Bug Description
The application throws an "Invalid regular expression: invalid group specifier name" error when processing certain regex patterns. This error occurs in JavaScript/TypeScript when using named capture groups or other regex features that may not be properly escaped or supported.
Affected Files
Root Cause
The error typically occurs when:
(?<name>...)Proposed Solution
Steps to Reproduce