[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Temporary case-folding in string-match()
From: |
Juanma Barranquero |
Subject: |
Re: Temporary case-folding in string-match() |
Date: |
Thu, 18 Dec 2008 12:39:39 +0100 |
On Thu, Dec 18, 2008 at 10:30, Nordlöw <per.nordlow@gmail.com> wrote:
> If I normally use case-folding, how do I *temporarily* set case-fold-
> search to nil when doing string-match()?
(let (case-fold-search)
(string-match ...))
or string-match-p, if you don't need the match data.
If you often want to do that, you can define your own function
(defun my-string-match (regexp string &optional start case-fold-search)
"Like `string-match', with a local binding of `case-fold-search'."
(string-match regexp string start)
so you can use it like a non-case-folding string-match, and if you
ever need the case-folding, you just do
(my-string-match my-regexp my-string nil t)
Juanma