in reply to Matching Regular expression at EOF

BTW, what do you consider the "last occurrence"? Given the pattern /(.).*\g{1}/ and the string "{abcdcba}", do you consider "abcdcba" to be the last, or "cdc"? The former has the last finish of the pattern, the latter the last start of the pattern.