From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Jay Bingham" Newsgroups: gmane.emacs.help Subject: RE: Storing regular expressions somewhere.... Date: Wed, 23 Aug 2006 18:29:06 GMT Message-ID: <20060823.113008.21820.634341@webmail10.nyc.untd.com> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: quoted-printable X-Trace: sea.gmane.org 1156357893 25062 80.91.229.2 (23 Aug 2006 18:31:33 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 23 Aug 2006 18:31:33 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Aug 23 20:31:31 2006 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1GFxVh-0001Vz-He for geh-help-gnu-emacs@m.gmane.org; Wed, 23 Aug 2006 20:31:29 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GFxVg-000488-Qd for geh-help-gnu-emacs@m.gmane.org; Wed, 23 Aug 2006 14:31:28 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1GFxVS-00047K-4Y for help-gnu-emacs@gnu.org; Wed, 23 Aug 2006 14:31:14 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1GFxVP-00040A-5A for help-gnu-emacs@gnu.org; Wed, 23 Aug 2006 14:31:13 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GFxVO-0003zv-UN for help-gnu-emacs@gnu.org; Wed, 23 Aug 2006 14:31:10 -0400 Original-Received: from [64.136.20.164] (helo=outbound-mail.nyc.untd.com) by monty-python.gnu.org with smtp (Exim 4.52) id 1GFxdH-0003NP-US for help-gnu-emacs@gnu.org; Wed, 23 Aug 2006 14:39:20 -0400 Original-Received: from webmail10.nyc.untd.com (webmail10.nyc.untd.com [10.141.27.150]) by smtpout01.nyc.untd.com with SMTP id AABCQ3HZMARE7RUJ for (sender ); Wed, 23 Aug 2006 11:31:07 -0700 (PDT) X-UNTD-OriginStamp: 9wMZ3l1+FG1mkmIQefRR9m5aYb8QGUX9HxTn1X42tRV6jDQYKTGPlp3VFDiMRHHG Original-Received: (from b.jc-emacs@netzero.com) by webmail10.nyc.untd.com (jqueuemail) id LYGTS5Q6; Wed, 23 Aug 2006 11:30:08 PDT Original-Received: from [15.235.153.107] by webmail10.nyc.untd.com with HTTP: Wed, 23 Aug 2006 18:29:06 GMT X-Originating-IP: [15.235.153.107] Original-To: help-gnu-emacs@gnu.org X-Mailer: Webmail Version 4.0 Content-Disposition: inline X-ContentStamp: 24:12:3238105497 X-MAIL-INFO: 5701d9041480bd14a1a180050d0565153839d55d152134d13421855db5b55d905d0479 X-UNTD-Peer-Info: 10.141.27.150|webmail10.nyc.untd.com|webmail10.nyc.untd.com|b.jc-emacs@netzero.com 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:36882 Archived-At: On Wednesday, 23 August 2006 Birju Prajapati wrote: > After digging around a bit, I found M-x regexp-builder. However, = this > doesn't seem to understand predefined character classes such as \s- > and seems to have a different regexp syntax. Is this a bug or am I > doing something wrong? First, I assume that when you say regexp-builder your are actually = referring to re-builder.el. Although I am not an re-builder guru, I have used it quite a bit and = I found it hard to believe that it did not understand the predefined = character classes, so I tried it. It works for me so you must be = doing something wrong. ;-) Before we get to what you could be doing wrong lets talk about what = you mean when you say that it has a different regexp syntax. Do you = mean that in the default input syntax, escape characters = (backslashes) must be doubled and double quotes must be escaped, = which means that regular expressions generated with this syntax = cannot be used in the interactive commands: isearch-forward-regexp, = query-replace-regexp and replace-regexp? Carefully reading of the commentary in re-builder reveals that there = are four forms of input syntax provided by re-builder: 'read', 'string', 'sregex' and 'lisp-re' The default input syntax form is: 'read' The syntax used by the 'read' form is the syntax that is used in the = arguments of functions like re-search-forward and re-search-backward, = which are used when an e-lisp function that does searching is = written. This syntax requires that escape characters and double = quotes be escaped. The syntax used by the 'string' form is the syntax that is used by = the interactive functions isearch-forward-regexp, query-replace- regexp and replace-regexp. As stated in the commentary, "With the `string' syntax there's no = need to escape the backslashes and double quotes simplifying the = editing somewhat." = Regarding the other two input forms the commentary states: "The other = two allow editing of symbolic regular expressions supported by the = packages of the same name. (`lisp-re' is a package by me and its = support may go away as it is nearly the same as the `sregex' package = in Emacs)." (I am not familiar with either of these packages and I = don't believe that they pertain to your situation so that is all that = will be said about them). Now that we have that out of the way, I suspect that what you were = doing wrong was trying to use 'string' syntax in 'read' syntax mode. Here is a regexp that I created while reading the re-builder = commentary after changing to string syntax (C-c C-i string RET): c\sw+?\(r\|w\)\w+\s- It matches 31 strings and the space that follows them in the re- builder.el file. This regexp matches 268 words and the space that follows them in the = re-builder.el file: \b\sw+?\(r\|w\)\w+\s- With the above regexp in the RE-Builder buffer when I change = from 'string' to 'read' syntax the regexp changes to the following: \\b\\sw+?\\(r\\|w\\)\\w+\\s- Changing back to 'string' syntax restores the regexp to its former = value. Good luck and thanks for the opportunity to learn more about re- builder. __ J_) C_)ingham = _____________________________________________________________________ PrivatePhone - FREE telephone number & voicemail. A number so private, you can make it public. http://www.privatephone.com