all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Elisp:  get word(s) from an re-match
@ 2015-03-26 13:20 Glen Stark
  2015-03-26 13:58 ` tomas
  0 siblings, 1 reply; 2+ messages in thread
From: Glen Stark @ 2015-03-26 13:20 UTC (permalink / raw)
  To: help-gnu-emacs

Hi everyone, I guess this is pretty trivial, but I'm struggling a 
little.  Consider the following:

for ( Foo::iterator itr = foo.begin() ;  itr != foo.end(); ++foo)

I want to to a regex search within elisp for this pattern, and extract 
into variables "foo" and "itr".

The goal is to write a refactoring script that takes old iterator loops 
and replaces them with for (auto x : foo), so I'd like to have the name 
of itr and the object being iterated over.

I'm competent enough with regex's to write the regex, and replace with \1 
and \2, which would get me through the auto statement, but I want to 
store the name of itr in a variable, so I can replace occurences of itr  
in the body of the code with the new auto variable.

Can somone point me in the right direction?  A simple example that 
extracts a string out of a regex match and returns it into a variable 
would be fantastic.

Many thanks,

Glen


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

end of thread, other threads:[~2015-03-26 13:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-26 13:20 Elisp: get word(s) from an re-match Glen Stark
2015-03-26 13:58 ` tomas

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.