@s0, @s1, @s2, ... @s9 - Last search group values
@s0 - Last search's whole match string
@s1 - Last search's first group value
@s2 - Last search's second group value
...
@s9 - Last search's nineth group value
The search group variables @sn return the string matches of the last regular expression search i.e. search-forward(2) (in magic(2m) mode) or regex-forward(3).
@s0 returns the whole of the matched string, @sn, n = 1..9, returns the bracket matches corresponding to the group demarkation points indicated by \( and \) in the search regular expression.
An error is generated if an attempt is made to access these variables and the last search failed or the last search did not have the specified group.
The value returned for an unused group, e.g. @s2 for the regex string "\(a\)\|\(b\)" if "a" was matched, is an empty string ("").
The following macro code gives a simple example of their potential use:
forward-search "Token *{\\(Start\\|End\\)}" !if $status ml-write "[found \"%s\"]" @s0 if &seq @s1 "Start" . .
Remember that the regular expression escape character '\' has to be duplicated within a macro file as '\' is also the macro file escape sequence.
(c) Copyright JASSPA 1999
Last Modified: 1999/09/06
Generated On: 1999/12/01