I would expect the register to contain the maximal length first match
to the parenthesized regular expression -- and nothing more.
Numbering of registers is, however, perhaps not as obvious. Should
register numbers not be assigned according to the order of the opening
parentheses? In your example, I would expect:
\1 = "d"
\2 = "d7"
In GNU regex, the "+" repeats the smallest possible preceding regular
expression as many times as possible (at least once) to yield the
maximum length match. In your example, the smallest possible
preceding regular expression is defined, by the parentheses, to be the
two character expression "[a-z][0-9]", so \(\([a-z]\)[0-9]\)+ matched
against "d7f7a9f6g8sdd" should return "d7f7a9f6g8".
>
> I don't have a clear opinion what should be in either \1 or \2.
> Currently, in my regexp package the value of a register is not
> well-defined if it is inside '+', '*', '?', or '|'.
>
> I am open to suggestions.
>
> Tatu
Martin
-- Martin A. Green Net : green@rd.hydro.on.ca Ontario Hydro Technologies Tel : (416) 207-5745 800 Kipling Ave, KR236 FAX : (416) 207-6216 Toronto, Ontario, CANADA, M8Z5S4