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

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

Re: Regexp to find second of three words


From: Eric Hanchrow
Subject: Re: Regexp to find second of three words
Date: Mon, 07 Aug 2006 10:27:58 -0700
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.51 (gnu/linux)

I probably misunderstand what you're trying to do with the stuff that
begins with \\(d\\(?:ef, but I imagine you'll be able to correct what
I've got.

(let ((p (rx "set"
             (one-or-more space) "'" (group (one-or-more (or alnum (any 
"*-_."))))
             (one-or-more space) (or "def" "does" "func" "function" "has" 
"lfinc" "sub")))
      (input "set 'printf function"))

  (string-match p input)
  (match-string 1 input))

-- 
Rarely do we find men who willingly engage in hard, solid
thinking.  There is an almost universal quest for easy answers
and half-baked solutions.  Nothing pains some people more
than having to think.
        -- Martin Luther King, Jr.
        from "Strength to Love," 1963.





reply via email to

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