I stole Gilles Castel's snippet for automatic subscript, and I tried to extend it to automatically subscript an i or j that follows any character. Here is my attempt
snippet '([A-Za-z])(?:\d|[ij])' "auto subscript" wrA
`!p snip.rv = match.group(1)`_`!p snip.rv = match.group(2)`
endsnippet
This throws
IndexError: no such group
Executed snippet code:
1 > snip.rv = match.group(2)
2
I do not know any Python, but I am hoping that this isn't a very tricky issue to solve. Any help is appreciated. Thank you.