I have a variable device='A/B/C/X1' that is commented out in another file. There can be multiple instances of the same device such as 'A/B/C/X1@1', ..@2 and so on. All of these devices are commented out in another file with a prefix *.
I want to remove the * but not affect similar devices like 'A/B/C/X**10**'.
I tried using regex to simply substitute a pattern using the following line of code, but I'm getting an InvalidExpression error.
line=re.sub('^*'+device+'@',device+'@',line)
Please help.