Regexp Replacers

Sandra Snan over at Idiomdrottning has posted a link to some very idiosyncratic functions that seem at first to be useless or even silly but may, on second thought, actually be useful for some applications. The idea is that they’re like replace-regexp but have the regexp predetermined. The functions are:

  • replace-word
  • replace-line
  • replace-paragraph
  • replace-var
  • replace-sentence

and they replace every instance of their target. For example, replace-word will replace every word in the target area with the substitution value. That doesn’t sound very useful but you can use & to substitute the match in the replacement. Snan has some examples in her post.

Again, these are low use functions but certain workflows may find them and the saving of entering a regexp useful.

This entry was posted in General and tagged . Bookmark the permalink.