all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Temporary case-folding in string-match()
@ 2008-12-18  9:30 Nordlöw
  2008-12-18 11:39 ` Juanma Barranquero
  2008-12-18 11:42 ` Stephen Berman
  0 siblings, 2 replies; 3+ messages in thread
From: Nordlöw @ 2008-12-18  9:30 UTC (permalink / raw)
  To: help-gnu-emacs

If I normally use case-folding, how do I *temporarily* set case-fold-
search to nil when doing string-match()?

/Nordlöw


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Temporary case-folding in string-match()
  2008-12-18  9:30 Temporary case-folding in string-match() Nordlöw
@ 2008-12-18 11:39 ` Juanma Barranquero
  2008-12-18 11:42 ` Stephen Berman
  1 sibling, 0 replies; 3+ messages in thread
From: Juanma Barranquero @ 2008-12-18 11:39 UTC (permalink / raw)
  To: Nordlöw; +Cc: help-gnu-emacs

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Temporary case-folding in string-match()
  2008-12-18  9:30 Temporary case-folding in string-match() Nordlöw
  2008-12-18 11:39 ` Juanma Barranquero
@ 2008-12-18 11:42 ` Stephen Berman
  1 sibling, 0 replies; 3+ messages in thread
From: Stephen Berman @ 2008-12-18 11:42 UTC (permalink / raw)
  To: help-gnu-emacs

On Thu, 18 Dec 2008 01:30:09 -0800 (PST) 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 ...)
  ...)
     
Steve Berman





^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-12-18 11:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-12-18  9:30 Temporary case-folding in string-match() Nordlöw
2008-12-18 11:39 ` Juanma Barranquero
2008-12-18 11:42 ` Stephen Berman

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.