From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: vb Newsgroups: gmane.emacs.help Subject: Regular expression search Date: Wed, 1 Nov 2006 11:31:30 -0800 Message-ID: <200611011131.30744.help-gnu-emacs@vsbe.com> References: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1162409808 28952 80.91.229.2 (1 Nov 2006 19:36:48 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 1 Nov 2006 19:36:48 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Nov 01 20:36:44 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 1GfLqP-0006uK-HP for geh-help-gnu-emacs@m.gmane.org; Wed, 01 Nov 2006 20:33:49 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GfLqO-0008Tu-Rh for geh-help-gnu-emacs@m.gmane.org; Wed, 01 Nov 2006 14:33:48 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1GfLoI-00074e-VM for help-gnu-emacs@gnu.org; Wed, 01 Nov 2006 14:31:39 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1GfLoE-00071B-LK for help-gnu-emacs@gnu.org; Wed, 01 Nov 2006 14:31:38 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GfLoE-00070q-6C for help-gnu-emacs@gnu.org; Wed, 01 Nov 2006 14:31:34 -0500 Original-Received: from [217.160.230.40] (helo=mout.perfora.net) by monty-python.gnu.org with esmtp (Exim 4.52) id 1GfLoD-0005S6-N8 for help-gnu-emacs@gnu.org; Wed, 01 Nov 2006 14:31:33 -0500 Original-Received: from [66.17.149.13] (helo=dhcp-10-64-129-2.riverstonenet.com) by mrelay.perfora.net (node=mrelayus1) with ESMTP (Nemesis), id 0MKp2t-1GfLoB39nU-0003u6; Wed, 01 Nov 2006 14:31:32 -0500 Original-To: help-gnu-emacs@gnu.org User-Agent: KMail/1.9.1 In-Reply-To: Content-Disposition: inline X-Provags-ID: perfora.net abuse@perfora.net login:105503e63a43ed9a8b379992658ba53b 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:38467 Archived-At: let's say I need a function to find first printable character on the line where the pointer is. This is what I'm trying to use: (defun vb-first-printable () (interactive) (let (limit-position) (beginning-of-line) (next-line 1) (setq limit-position (point)) (previous-line 1) (re-search-forward "\\S" limit-position 't))) when I try executing this, I get the following error: ==================================================== Debugger entered--Lisp error: (invalid-regexp "Premature end of regular expression") re-search-forward("\\S" 3543 t) (let (limit-position) (beginning-of-line) (next-line 1) (setq limit-position (point)) (previous-line 1) (re-search-forward "\\S" limit-position (quote t))) vb-first-printable() call-interactively(vb-first-printable) =================================================== the same problem happens when I try re-search-forward from the command line: if I enter "\S" as the pattern to search, I get "premature end of regular expression" error, but if I enter "\\S" as the regular expression pattern, the only thing it finds is this pattern (\\S) itself (as I try it on the same file where the source code is). What am I missing here? TIA, \vb