help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: Searching for a string in a string


From: Pascal J. Bourguignon
Subject: Re: Searching for a string in a string
Date: Mon, 28 Sep 2009 14:57:25 +0200
User-agent: Gnus/5.101 (Gnus v5.10.10) Emacs/22.2 (gnu/linux)

Nordlöw <per.nordlow@gmail.com> writes:

> Is there a variant of string-match() that searches for a string (sub-
> string) instead of a regexp?

(defun literal-string-match (substring string &optional start)
   (string-match (regexp-quote substring) string (or start 0)))

(literal-string-match "..?" "Hello? world..? ah!") --> 12


-- 
__Pascal Bourguignon__


reply via email to

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