On Tue, Apr 26, 2011 at 10:03 AM, Rich Shepard <rshep...@appl-ecosys.com> wrote: > Mea culpa! I cannot recall the metacharacter for use in an emacs > search-and-replace regex to replace the original search string. My Google > searches find everything but this. > > Example: I want to search for ABCD and replace that with ABCD$ (that is, > add a newline after the search string). I'm drawing a total blank on how to > write the replace regex and need a clue stick.
I'm not sure how to reference the entire search string, but you can reference subsets with escaped parens. To get around some difficult notation issues, here's how you tack "foo" onto the end of ABCD: query for: \(ABCD\) replace with: \1foo In general, things in parens can be referenced by \N where N increases as you encounter open parens from the left-side of the search string. --Rogan > > Rich > > _______________________________________________ > PLUG mailing list > PLUG@lists.pdxlinux.org > http://lists.pdxlinux.org/mailman/listinfo/plug > _______________________________________________ PLUG mailing list PLUG@lists.pdxlinux.org http://lists.pdxlinux.org/mailman/listinfo/plug