Path: utzoo!utgpu!water!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!mailrus!umix!nancy!eecae!fmsrl7!teemc!rolls!mtuxo!homxb!ho7cad!msb From: msb@ho5cad.ATT.COM Newsgroups: comp.emacs Subject: Re: GNU Emacs string modification question Message-ID: <321@ho7cad.ATT.COM> Date: 28 Apr 88 15:43:33 GMT References: <11715@tut.cis.ohio-state.edu> Sender: nuucp@ho7cad.ATT.COM Lines: 25 In-reply-to: karl@tut.cis.ohio-state.edu's message of 27 Apr 88 04:23:40 GMT In article <11715@tut.cis.ohio-state.edu> karl@tut.cis.ohio-state.edu (Karl Kleinpaste) writes: > I have a variable which has been setq'd to a string value. The string > may contain characters which are special to RE searches, but I need > the characters to be used literally in searches. (Specifically, I am > looking at newsgroup name searches in the vn emulator, possibly > containing +'s, e.g., comp.lang.c++.) I cannot avoid performing the > search as re-search-forward; plain search-forward will not do, due to > the need to find "[:!]" following the newsgroup name. Can anyone give > me a simple function which takes a string argument and inserts > backslashes (\) in front of RE-special characters within the string? > > --Karl spell.el uses a function regexp-quote. Should do exactly what you want. Here is the function-help. regexp-quote: Return a regexp string which matches exactly STRING and nothing else. ---------------------------------------------------------------------- Michael S. Balenger (201) 949-8789 AT&T Bell Labs Crawfords Corner Road ihnp4!ho5cad!msb Holmdel, NJ 07733