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

Regular expression support #152

Closed
hairyhenderson opened this issue May 30, 2017 · 0 comments
Closed

Regular expression support #152

hairyhenderson opened this issue May 30, 2017 · 0 comments
Assignees

Comments

@hairyhenderson
Copy link
Owner

hairyhenderson commented May 30, 2017

It'd be useful to have a sort of sed capability inside templates... Probably some simple wrapping of regexp.ReplaceAllString.

The usage should be something like regexp.Replace "expression" "replacement" "input":

$ gomplate -i '{{ "1.2.3-59" | regexp.Replace `-([0-9]*)` `.$1` }}'
1.2.3.59

I'm not sure about the function name though. replaceAll is taken and doesn't handle regexes - maybe we could just modify replaceAll to support regexp instead, though that would certainly break some users. I'm not sure I like regex.Replace, but... 🤔

@hairyhenderson hairyhenderson self-assigned this Jun 14, 2017
@hairyhenderson hairyhenderson changed the title Regex support Regular expression support Jun 14, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant