Questions tagged [query-replace-regexp]

39 questions
2
votes
1 answer

Search and replace with many possible replacements?

Suppose I have a code base with many instances of string "console.log(" for example. I want to replace each one with one of the following six lines: logger(FATAL, logger(ERROR, logger(WARNING, logger(INFO, logger(LOG, logger(DEBUG, Each…
Ambrose
  • 23
  • 4
1
vote
2 answers

Matching non-# in Regexp

I'm trying to use replace-regexp to change the following code samples <- rep(10, 5)*1000 ## steps determined by samples * thin adaptive.ratio <- c(rep(c(1,0), 2), 0) ## Alternate between adaptive and non-adaptive ... to print(paste0("samples: ",…
mikemtnbikes
  • 233
  • 2
  • 10
0
votes
2 answers

Is it possible for a query-replace-regexp to replace the value with a computed value?

I want to convert the timestamps in a .zsh_history file to their readable equivalents. Does query-replace-regex or some other function provide the ability to replace the match with the value of a function like something like (format-time-string…
vfclists
  • 1,403
  • 1
  • 12
  • 28