Skip to content

docs: clarify the args of regexReplaceAll and regexReplaceAllLiteral #1738

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

Conversation

aabouzaid
Copy link

Hi 👋

I've added a tiny clarification for the regexReplaceAll and regexReplaceAllLiteral functions, as they have an unusual args order (the input is in the middle).

That will make the example easier to read.

@aabouzaid aabouzaid force-pushed the update-regex-replace-docs branch 2 times, most recently from 6d49a80 to c3ec962 Compare July 3, 2025 23:59
@yxxhero yxxhero force-pushed the update-regex-replace-docs branch from c3ec962 to a5b3f01 Compare July 4, 2025 23:25
Copy link
Contributor

@TerryHowe TerryHowe left a comment

Choose a reason for hiding this comment

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

None of the other commands provide usage and this looks a little awkward without something in between the usage and example:

Screenshot 2025-07-05 at 11 39 33 AM

@@ -905,6 +905,10 @@ replacement string replacement. Inside string replacement, $ signs are
interpreted as in Expand, so for instance $1 represents the text of the first
submatch
```
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
```
```yaml

Maybe set format for these examples?

Copy link
Author

Choose a reason for hiding this comment

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

@TerryHowe Good idea, I'd like to make it, but it's not there in the English version.
Should I make the change to all regex* sections?

Copy link
Contributor

Choose a reason for hiding this comment

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

Format type doesn't seem to matter much here as near as I can tell.

I am not a maintainer on this project and I don't know if they want usage for these.

There are PRs on these methods frequently and I don't exactly know why Sprig docs aren't just included or referenced here https://masterminds.github.io/sprig/strings.html

@aabouzaid aabouzaid requested a review from TerryHowe July 12, 2025 09:46
@aabouzaid aabouzaid force-pushed the update-regex-replace-docs branch from 3395e77 to eb62ca6 Compare July 12, 2025 09:46
@aabouzaid
Copy link
Author

None of the other commands provide usage and this looks a little awkward without something in between the usage and example:
Screenshot 2025-07-05 at 11 39 33 AM

I did it that way to update all languages, but I can only add the text for English.

Here is how it looks after the change (I will remove the changes from other languages if we agree on that)

3fc589e

Comment on lines 906 to 907
submatch. The first argument is `<pattern>`, second is `<input>`, and third is
`<replacement>`.
Copy link
Contributor

Choose a reason for hiding this comment

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

I think your PR will have a better chance of merging if you limit it to these two lines and the change on line 922. Try just the english version.

Copy link
Author

Choose a reason for hiding this comment

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

@TerryHowe Makes sense. I limited the change to that part only.
Thanks for your feedback 🙌

@aabouzaid aabouzaid force-pushed the update-regex-replace-docs branch from 3fc589e to 19a0eb5 Compare July 14, 2025 21:13
@aabouzaid aabouzaid force-pushed the update-regex-replace-docs branch from 19a0eb5 to 7aa48c6 Compare July 14, 2025 21:15
@aabouzaid aabouzaid requested a review from TerryHowe July 14, 2025 21:17
Copy link
Contributor

@TerryHowe TerryHowe left a comment

Choose a reason for hiding this comment

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

/lgtm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants