python re.sub, only replace part of match

I am very new to python I need to match all cases by one regex expression and do a replacement. this is a sample substring –> desired result: <cross_sell id="123" sell_type="456"> –> <cross_sell> i am trying to do this in my code: myString = re.sub(r'<[A-Za-z0-9_]+(s[A-Za-z0-9_="s]+)', "", myString) instead of replacing everything after <cross_sell, it replaces … Read more