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

Replacements in ReplaceInFiles should accept regex patterns #622

Closed
ryanewtaylor opened this issue Jan 15, 2015 · 4 comments
Closed

Replacements in ReplaceInFiles should accept regex patterns #622

ryanewtaylor opened this issue Jan 15, 2015 · 4 comments

Comments

@ryanewtaylor
Copy link
Contributor

Currently, it appears the patterns used in ReplaceInFiles must match the string you want to replace exactly. However, it would be very helpful if instead of an exact match the regular expressions could be used in the pattern matching. This would enable, for instance, replacing version strings in arbitrary files with an expression akin to:

    !! ".\**\AssemblyInfo.cs"
        |> ReplaceInFiles [("[\d]\.[\d]\.[\d]\.[\d]", version)]

    // replace Major.minor.revision.build with the desired version
@forki
Copy link
Member

forki commented Jan 15, 2015

This would be a breaking change, right?
How about a new function which does this?

I mark this as up-for-grabs if you are interested please send a PR.

@ryanewtaylor ryanewtaylor changed the title Replacements in ReplaceInFiles should accept regex patterns for pattern matching Replacements in ReplaceInFiles should accept regex patterns Jan 15, 2015
@ryanewtaylor
Copy link
Contributor Author

Yeah. That might be a breaking change. Perhaps an additional argument with a default value could be added that defaulted to the current behavior but when provided would use regex to find matches? Then again, perhaps a separate ReplaceInFilesRegex would be cleaner.

ryanewtaylor added a commit to ryanewtaylor/FAKE that referenced this issue Feb 9, 2015
…sprojects#622

The current implementation requires that the caller specify the encoding
for the files that they are processing. Future enhancements may include
auto-detection of the file encoding to make usage a little cleaner.
@ryanewtaylor
Copy link
Contributor Author

@forki, I am not sure of the proper protocol for closing F# - FAKE issues. I believe this issue was initially met by PR #649. May I close this issue or would you prefer to do so?

@forki
Copy link
Member

forki commented Apr 7, 2015

You can just close issues when things are fixed. Thanks

@forki forki closed this as completed Apr 7, 2015
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

2 participants