Path: utzoo!mnetor!uunet!lll-winken!lll-tis!ames!pasteur!ucbvax!smpvax1.UUCP!sbb From: sbb@smpvax1.UUCP Newsgroups: comp.emacs Subject: Re: GNU Emacs string modification question Message-ID: <8805030257.AA14943@trwrb> Date: 3 May 88 02:57:58 GMT References: <11715@tut.cis.ohio-state.edu> Sender: daemon@ucbvax.BERKELEY.EDU Organization: The Internet Lines: 24 From: Karl Kleinpaste 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, GNU Emacs comes with a function called "regexp-quote". It takes a string that may contain regular expression chars and puts in suitable quoting characters so that the returned string will match (in regexp contexts) exactly the string passed as its argument. steve ----------------------- Steve Byrne ...ucbvax!trwrb!smpvax1!sbb Inference Corp. (213) 417-7997 5300 W. Century Blvd. Los Angeles, CA 90045