From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Suvayu Ali Newsgroups: gmane.emacs.help Subject: Re: Question about string-match and match-string Date: Wed, 17 Jul 2013 12:02:47 +0200 Message-ID: <20130717100247.GA22656@kuru.dyndns-at-home.com> References: <20130717081704.GB16899@kuru.dyndns-at-home.com> <877ggpzhxh.fsf@yahoo.fr> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1374055389 16933 80.91.229.3 (17 Jul 2013 10:03:09 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 17 Jul 2013 10:03:09 +0000 (UTC) Cc: Emacs help To: Nicolas Richard Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Jul 17 12:03:08 2013 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1UzOZd-0005y2-8A for geh-help-gnu-emacs@m.gmane.org; Wed, 17 Jul 2013 12:03:05 +0200 Original-Received: from localhost ([::1]:53440 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UzOZc-0007uX-TQ for geh-help-gnu-emacs@m.gmane.org; Wed, 17 Jul 2013 06:03:04 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:33245) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UzOZS-0007tw-1S for help-gnu-emacs@gnu.org; Wed, 17 Jul 2013 06:02:55 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UzOZQ-0006Lo-W4 for help-gnu-emacs@gnu.org; Wed, 17 Jul 2013 06:02:53 -0400 Original-Received: from mail-we0-x22f.google.com ([2a00:1450:400c:c03::22f]:53476) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UzOZQ-0006Lg-Q9 for help-gnu-emacs@gnu.org; Wed, 17 Jul 2013 06:02:52 -0400 Original-Received: by mail-we0-f175.google.com with SMTP id t59so1567504wes.20 for ; Wed, 17 Jul 2013 03:02:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=Yuc8cQW+IKcvaHq3mZu8SvQnjvFZRaNzA3h5AOYpCWo=; b=uvo6Zbkhxn4S5XSftd04BbZEkeHKmlTq3OEseVBGInjrJfAOGNGjOcZxZFsiO63Sx/ Ivc/wKlSaghJBe0Ph1EYslmU9OookGUONyhUh7IVTxlTgo1SkVHaYrPJ69vubKHE7hgf mrb/i7LXrWmKA1+Td1eoMg0z4i+IZ5225ZzD+2hDQ9IDDb+Is6oqIf7XgKBZwvGlfYqa n+0YBOovhelIv1C0TQFsw0S/S9wyS8UMXyLnETBQB4oqfc0tj94EcPzx6p2HAX7Z8Vjj b39ScJ55LNjmN/dHfKRy889ogiDXnmDpHA+kpwr28r82o500el9Gtbshd/HgF5mRB0UV ANNA== X-Received: by 10.194.108.73 with SMTP id hi9mr4209717wjb.85.1374055371999; Wed, 17 Jul 2013 03:02:51 -0700 (PDT) Original-Received: from kuru.dyndns-at-home.com ([2001:610:120:3001:f2de:f1ff:fe37:c76c]) by mx.google.com with ESMTPSA id u9sm8463790wif.6.2013.07.17.03.02.50 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Wed, 17 Jul 2013 03:02:50 -0700 (PDT) Content-Disposition: inline In-Reply-To: <877ggpzhxh.fsf@yahoo.fr> User-Agent: Mutt/1.5.21 (2012-12-30) X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:400c:c03::22f X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:92201 Archived-At: Hi Nicolas, On Wed, Jul 17, 2013 at 10:53:14AM +0200, Nicolas Richard wrote: > > > PS: I'm also not very clear why we need 4 \-s in the regex to match a > > single \ in the string. I came up with it by trial and error with the > > regexp-builder. Any explanation about that would also be great. > > I hope the above is an explanation of that. Just remember there are two > steps: > (i) emacs reads the string > (ii) the string is made into a regexp > so for matching on \, you need the regexp \\, which is obtained by the > string "\\\\" (e.g. (insert "\\\\") inserts \\) Thank you for the very clear explanation. It was very helpful. :) Cheers, -- Suvayu Open source is the future. It sets us free.