Skip to content

template: Add the replace method to string #6998

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

matts1
Copy link
Contributor

@matts1 matts1 commented Jul 17, 2025

Checklist

If applicable:

  • I have updated CHANGELOG.md
  • I have updated the documentation (README.md, docs/, demos/)
  • I have updated the config schema (cli/src/config-schema.json)
  • I have added/updated tests to cover my changes

@matts1 matts1 marked this pull request as ready for review July 17, 2025 01:21
@matts1 matts1 requested a review from a team as a code owner July 17, 2025 01:21
@matts1
Copy link
Contributor Author

matts1 commented Jul 17, 2025

My use case here is that I want a template that outputs the canonical form of a list of bugs associated with a commit. Our bugs can be:

  • b:12345
  • b/12345
  • 12345

Additionally, they can be seperated by spaces, commas, or ", ". Replace is required to canonicalize this.

This is required to be done in the templating language because I'd like to be able to pre-fill a commit description with the bugs from all of its parents.

@yuja
Copy link
Contributor

yuja commented Jul 17, 2025

cc @lf-

We have ongoing PRs that add regex:<pattern>. I think it's better to add .replace(pattern, subst) after these PRs get merged.

#6893

@lf-
Copy link
Contributor

lf- commented Jul 17, 2025

yeah here: #6899

i think that we might want to do some way to grab capture groups while doing the api design for replacement

@PhilipMetzger
Copy link
Contributor

Can you put your motivation into the commits description, thanks.

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.

4 participants