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

config: add "replace" function [GH-1029] #1094

Merged
merged 4 commits into from
Mar 2, 2015
Merged

config: add "replace" function [GH-1029] #1094

merged 4 commits into from
Mar 2, 2015

Conversation

mitchellh
Copy link
Contributor

Fixes #1029

This adds a replace function. From the docs:

  * `replace(string, search, replace)` - Does a search and replace on the
      given string. All instances of `search` are replaced with the value
      of `replace`. If `search` is wrapped in forward slashes, it is treated
      as a regular expression. If using a regular expression, `replace`
      can reference subcaptures in the regular expression by using `$n` where
      `n` is the index or name of the subcapture. If using a regular expression,
      the syntax conforms to the [re2 regular expression syntax](https://code.google.com/p/re2/wiki/Syntax).

t.Fatalf("%d: bad: %#v", i, out)
t.Fatalf(
"%d: bad output for input: %s\n\nOutput: %#v",
i, tc.Input, out)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This one is for you @phinze.

Copy link
Contributor

Choose a reason for hiding this comment

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

@phinze
Copy link
Contributor

phinze commented Mar 2, 2015

LGTM! I can barely keep up with you this morning! 😛

@mitchellh
Copy link
Contributor Author

@phinze I've just been doing a bunch of easy things while you toil away at the hard things. ;) One of those "I need easier things" mornings. Haha.

mitchellh added a commit that referenced this pull request Mar 2, 2015
config: add "replace" function [GH-1029]
@mitchellh mitchellh merged commit 76e3cfc into master Mar 2, 2015
@mitchellh mitchellh deleted the f-gsub branch March 2, 2015 17:47
@ghost
Copy link

ghost commented May 4, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@ghost ghost locked and limited conversation to collaborators May 4, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature Request: gsub
2 participants