10.3.2 Node Regular Expressions
Use of the facilities in this clause in the style or transformation languages requires the regexp feature.
The regexp type represents a node regular expression.  A node regular expression is an object that can be used to perform an auxiliary parse of a grove.  This auxiliary parse creates a new grove that contains nodes that group together nodes that correspond to nodes in the original grove. The semantics of a node regular expression define for any node-list s and any node-list t that is a sublist of s whether t matches the node regular expression with respect to s.  This is defined inductively for each of the procedures that construct regexps. s is referred to as the search list.
A node-list s immediately precedes a node-list t with respect to a node-list x that contains all the members of both s and t if

•  s is empty, or

•  t is empty, or


•  the member of s that occurs latest in x occurs in x before the element of t that occurs first in x, and

•  there is no node in x that

•  follows in x all those members of x that occur in s, and

•  precedes in x all those members of x that occur in t.
(regexp? obj)
Returns #t if obj is a regexp, and otherwise returns #f.