[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Regular expression search

From: vb
Subject: Regular expression search
Date: Wed, 1 Nov 2006 11:31:30 -0800
User-agent: KMail/1.9.1

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 ()
  (let (limit-position)
    (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 
  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 

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?


reply via email to

[Prev in Thread] Current Thread [Next in Thread]