GNU Info

Info Node: (elisp)Match Data

(elisp)Match Data


Next: Searching and Case Prev: Search and Replace Up: Searching and Matching
Enter node , (file) or (file)node

The Match Data
==============

   Emacs keeps track of the start and end positions of the segments of
text found during a regular expression search.  This means, for example,
that you can search for a complex pattern, such as a date in an Rmail
message, and then extract parts of the match under control of the
pattern.

   Because the match data normally describe the most recent search only,
you must be careful not to do another search inadvertently between the
search you wish to refer back to and the use of the match data.  If you
can't avoid another intervening search, you must save and restore the
match data around it, to prevent it from being overwritten.

Replacing Match
Replacing a substring that was matched.
Simple Match Data
Accessing single items of match data,
such as where a particular subexpression started.
Entire Match Data
Accessing the entire match data at once, as a list.
Saving Match Data
Saving and restoring the match data.

automatically generated by info2www version 1.2.2.9