Recase.Replace (recase v0.7.0) View Source

Helper module to pipe and replace values easily.

Link to this section Summary

Functions

Replaces value if it matches regex with new_value.

Link to this section Functions

Link to this function

replace(value, regex, new_value)

View Source

Specs

replace(String.t(), Regex.t(), String.t() | (... -> String.t())) :: String.t()

Replaces value if it matches regex with new_value.

Standard Regex.replace/3 accepts value to replace as the second argument. Which is not quite convenient to use in pipes.

This function accepts value as the first argument and then passes it to Regex.replace/3 as the second one.