From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Barry Margolin Newsgroups: gmane.emacs.help Subject: Re: problem re-search with the \| op. Date: Thu, 10 Jan 2008 22:35:34 -0500 Organization: Symantec Message-ID: References: NNTP-Posting-Host: lo.gmane.org X-Trace: ger.gmane.org 1200022833 10151 80.91.229.12 (11 Jan 2008 03:40:33 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 11 Jan 2008 03:40:33 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Jan 11 04:40:54 2008 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1JDAlJ-0006S0-R7 for geh-help-gnu-emacs@m.gmane.org; Fri, 11 Jan 2008 04:40:54 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JDAkw-0002C6-AY for geh-help-gnu-emacs@m.gmane.org; Thu, 10 Jan 2008 22:40:30 -0500 Original-Path: shelby.stanford.edu!headwall.stanford.edu!newshub.sdsu.edu!border1.nntp.dca.giganews.com!nntp.giganews.com!local01.nntp.dca.giganews.com!nntp.comcast.com!news.comcast.com.POSTED!not-for-mail Original-NNTP-Posting-Date: Thu, 10 Jan 2008 21:35:35 -0600 Original-Newsgroups: gnu.emacs.help Mail-Copies-To: nobody User-Agent: MT-NewsWatcher/3.5.3b2 (PPC Mac OS X) X-Copies-To: never Original-Lines: 46 X-Usenet-Provider: http://www.giganews.com Original-NNTP-Posting-Host: 24.34.108.171 Original-X-Trace: sv3-fjsPmYjiAtpUEtMYcbjt5eA01Rj35niXsdn+AyzdvWIJv8H6+IcuSevKe9tK7/SD0isZkwFrIfLNpkK!+0Fx7U3UhAXbeunZRUEJc8I6Ju/xeMyqz80Fq1HKAtL/RA3GYC2Cd1aLz8zVLlAu4mwBjSWD8Qx5!wkLhY/VIbHsXpdAKRqNDeIEXzIz0XiUjd6WEEVIuMQ== Original-X-Complaints-To: abuse@comcast.net X-DMCA-Complaints-To: dmca@comcast.net X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.37 Original-Xref: shelby.stanford.edu gnu.emacs.help:155232 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:50648 Archived-At: In article , rtra wrote: > Hi, > > I'm having problems searching for a regular expression matching two > alternatives, A or B. > A = "#title " > B = "\* [A-Z][a-z]+.*" > and allow '.' (dot) to be string concatenation '.' is string concatenation in Perl, not Lisp. Lisp does everything using functions, not operators like this. The string concatenation function is concat. > > (re-search-backward A 1 t) matches the string A as I intended, and > (re-search-backward B 1 t) also matches B as intended, but > (re-search-backward A."\|".B 1 t) does not matches A or B as I thought > it should (re-search-backward (concat a "\\|" b) 1 t) You need to escape the backslash because it has a special meaning in strings. > > I'm using GNU Emacs 22.1.1, and testing this with a file like > ----8<---- > #title test > * tset > > > ----8<---- > > Thank you for you time. > (I've wasted some in the manual, but I'm not figuring this out...) > > Rui Almeida -- Barry Margolin, barmar@alum.mit.edu Arlington, MA *** PLEASE post questions in newsgroups, not directly to me *** *** PLEASE don't copy me on replies, I'll read them in the group ***