Sorry for not being clear. Let me explain what I am trying to do.
"a" could fall under one of the following category.
a = '(m1 m1_1 m1_2...) or a = '(mn_1 mn_1_1 mn_1_2...)
My end goal is to get the "original name (orig_name) with out _[1-9]. And if the original name itself had _[0-9] in it, I need to handle it appropriately.
I have implemented the following to handle this scenario.
if(rexExecute(orig_name) then mainInst = car(setof(i insts !rexMatchp("@" i) && !rexMatchp("_[0-9]_[1-9][0-9]*$" i)))
else parentInst = car(setof(i insts !rexMatchp("@" i) && !rexMatchp("_[1-9][0-9]*$" i)))
Is there a better way to handle this? Thanks.