GNU Emacs Lisp Reference Manual
The functions match-data and set-match-data read or write the entire match data, all at once.
(match-beginning n); and element number 2n + 1 corresponds to (match-end n). All the elements are markers or nil if matching was done on a buffer, and all are integers or nil if matching was done on a string with string-match. (In Emacs 18 and earlier versions, markers were used even for matching on a string, except in the case of the integer 0.)
As always, there must be no possibility of intervening searches between the call to a search function and the call to match-data that is intended to access the match data for that search.
(match-data)
=> (#
#
#
#)
match-data. If match-list refers to a buffer that doesn't exist, you don't get an error; that sets the match data in a meaningless but harmless way.
store-match-data is an alias for set-match-data.