Skip to content

feat: add regex support to path matching via regex_paths flag#177

Open
Megh03 wants to merge 3 commits into
mainfrom
SUP-5448/Add-regex-support-to-the-path-skip_path-except_path-parameters
Open

feat: add regex support to path matching via regex_paths flag#177
Megh03 wants to merge 3 commits into
mainfrom
SUP-5448/Add-regex-support-to-the-path-skip_path-except_path-parameters

Conversation

@Megh03
Copy link
Copy Markdown

@Megh03 Megh03 commented May 29, 2026

Add a new boolean option to watch blocks in the plugin config. When set to true, all path matching for ,and is handled by regexp2 instead of the existing glob/prefix matching.

When regex_paths is false (the default), existing glob and prefix matching behaviour is completely unchanged ,so no impact on existing users.

Changes:

  • plugin.go: added RegexPaths field to WatchConfig struct
  • pipeline.go: updated matchPath to accept a useRegex flag and route through regexp2 when set; updated all 3 call sites in stepsToTrigger
  • pipeline_test.go: added TestRegexPaths with 10 test cases covering lookaheads, skip_path, except_path, invalid regex, mixed blocks, and regression check for existing glob behaviour
  • plugin.yml: documented regex_paths as a boolean property
  • README.md: added regex_paths section with customer example pattern

  Add a new  boolean option to watch blocks in the plugin
  config. When set to true, all path matching for , ,
  and  is handled by regexp2 instead of the existing
  glob/prefix matching.

  regexp2 was chosen over Go's stdlib regexp package because it supports
  full PCRE syntax including negative lookaheads, which is required for
  the customer's use case of collapsing 30+ glob patterns into a single
  regex expression.

  When regex_paths is false (the default), existing glob and prefix
  matching behaviour is completely unchanged — no impact on existing users.

  Changes:
  - plugin.go: added RegexPaths field to WatchConfig struct
  - pipeline.go: updated matchPath to accept a useRegex flag and route
    through regexp2 when set; updated all 3 call sites in stepsToTrigger
  - pipeline_test.go: added TestRegexPaths with 10 test cases covering
    lookaheads, skip_path, except_path, invalid regex, mixed blocks,
    and regression check for existing glob behaviour
  - plugin.yml: documented regex_paths as a boolean property
  - README.md: added regex_paths section with customer example pattern

  Closes SUP-5848
@Megh03 Megh03 requested a review from a team as a code owner May 29, 2026 20:18
@Megh03 Megh03 marked this pull request as draft May 29, 2026 20:22
@Megh03 Megh03 marked this pull request as ready for review May 29, 2026 20:25
Copy link
Copy Markdown
Contributor

@petetomasik petetomasik left a comment

Choose a reason for hiding this comment

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

Great work @Megh03! Just a few comments, suggestions, questions.

Comment thread plugin.go Outdated
Comment thread README.md Outdated
Comment thread pipeline_test.go
Comment thread pipeline.go
Comment thread README.md
@Megh03 Megh03 marked this pull request as draft May 29, 2026 21:08
  - run make quality to fix spacing on RegexPaths field
  - anchor README example pattern with ^ to prevent partial path matches
  - add TestPluginParsesRegexPaths to plugin_test.go
  - add MatchTimeout to prevent catastrophic backtracking
  - improve error message when glob syntax is used with regex_paths: true
@Megh03 Megh03 force-pushed the SUP-5448/Add-regex-support-to-the-path-skip_path-except_path-parameters branch from b9ab9d9 to 8c97966 Compare May 29, 2026 21:37
@Megh03 Megh03 marked this pull request as ready for review May 29, 2026 21:39
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.

3 participants