emacs-devel
[Top][All Lists]
Advanced

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

Search function that ignores some characters


From: tony-au
Subject: Search function that ignores some characters
Date: Fri, 9 Dec 2011 11:09:22 -0800 (PST)

Hello,
I would like to implement a search function that ignores some characters
(like these
characters { '.', ',' , 'X'}). So if I search "word", the function should
not
only find "word" but also "wor.d", "wo,rd.", "w,,o..X,r..d", and so
on. That means I want to search w[.,X]*o[.,X]*r[.,X]d as a regexp.

The function my-regexp produces the regexp and insert it into the buffer 
(defun my-regexp (&optional regexp-p no-recursive-edit)
  (interactive "P\n")
  (setq str (read-from-minibuffer
             "the word: "))
  (insert-before-markers
   (mapconcat (lambda (c) (regexp-quote (string c))) str "[.,X]*"))
  )

But then I have to kill the produced regexp from the buffer and insert it
into the minibuffer of "C-M-s" (Regexp I-search). 
This is not really comfortable. How can directly insert the regexp (in the
example: w[.,X]*o[.,X]*r[.,X]d) into the minibuffer of (Regexp I-search)?

-- 
View this message in context: 
http://old.nabble.com/Search-function-that-ignores-some-characters-tp32944985p32944985.html
Sent from the Emacs - Dev mailing list archive at Nabble.com.




reply via email to

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