- -- Add a pattern for this base
- submatches[#submatches+1] = "^(" .. base .. ")([%a%d,]+)$"
+ -- Add a patterns for this base. First, the base with a single
+ -- letter or number subscript.
+ submatches[#submatches+1] = "^(" .. base .. ")([%a%d])$"
+ -- Seconde, the base with a longer prefix that includes at least
+ -- one of +-, (to catch things like ri+1, but not return).
+ submatches[#submatches+1] = "^(" .. base .. ")([%a%d]*[%-%+%,]+[%a%d%-%+%,]*)$"