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

Provide a built-in function that performs multi-line replacement #141

Open
dakusui opened this issue Apr 15, 2020 · 0 comments
Open

Provide a built-in function that performs multi-line replacement #141

dakusui opened this issue Apr 15, 2020 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@dakusui
Copy link
Owner

dakusui commented Apr 15, 2020

Provide a built-in function that performs multi-line replacement based on provided regex.

function replace_multilines() {
  local string_before_replacement="${1}"
  local begin_regex="${2}"
  local end_regex="${3}"
  local replacement="${4}"
  ...
  echo "${string_after_replacement}"
}
replace_multilines 'function hi_there() {
  echo "hi there"
}' 'hi_[a-z]+\(\)' '\}' 'hi_there() { echo "HI THERE" }'

Results in

function hi_there() { echo "HI THERE"}
@dakusui dakusui self-assigned this Apr 15, 2020
@dakusui dakusui added the enhancement New feature or request label Apr 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant