From: tony-au <auto51@hushmail.com>
To: Emacs-devel@gnu.org
Subject: Search function that ignores some characters
Date: Fri, 9 Dec 2011 11:09:22 -0800 (PST) [thread overview]
Message-ID: <32944985.post@talk.nabble.com> (raw)
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.
next reply other threads:[~2011-12-09 19:09 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-09 19:09 tony-au [this message]
2011-12-09 19:34 ` Search function that ignores some characters Drew Adams
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=32944985.post@talk.nabble.com \
--to=auto51@hushmail.com \
--cc=Emacs-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).