Hi all, I don't know anything about regular expressions and I have two questions:
No products are associated with this question.
Assuming a string x,
[a, b] = regexp(x, '(a|d|(ee))(_)([0-9]*)', 'start', 'end')
will find the start and end indices of your "variables." This will allow for a variable a_0 which may or may not be desired. Without a rule for defining functions that handles the numerous edge cases, creating the regexp is difficult. Andrei's answer seems reasonable to me.