Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support regex capture groups as arguments #276

Merged
merged 2 commits into from
Jun 28, 2022

Conversation

justmiles
Copy link
Contributor

Proposed change

This change adds support for regex capture groups as input arguments (closes #10). It does so by taking advantage of named & numbered capture groups in the standard library.

This can be used in both "respond" and "hear" rules. Doing so adds argument support for "hear" rules, discussed in #204.

In the following example, the capture group named word is processed as an argument with the same name.

name: hear
active: true
hear: /can you say (?P<word>\S+) for me/
format_output: "I can say ${word} for you"

See the unit tests for more detailed examples.

Types of changes

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist

  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)

@coveralls
Copy link

coveralls commented Jun 22, 2022

Pull Request Test Coverage Report for Build 2543700057

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 0.0%

Totals Coverage Status
Change from base Build 2498854726: 0.0%
Covered Lines: 0
Relevant Lines: 0

💛 - Coveralls

Copy link
Collaborator

@wass3r wass3r left a comment

Choose a reason for hiding this comment

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

thanks a ton. let us know if you're adding to docs, otherwise i'll make a story to do so.

@justmiles
Copy link
Contributor Author

Here's an accompanying PR for documentation: target/flottbot-docs#57

@wass3r wass3r merged commit b3f5996 into target:main Jun 28, 2022
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.

Add ability to use capturing group from regex in actions
3 participants