import ret = 'String_BA22_FR22_BC'print(re.sub(r'FR\d+', 'FR', t))print(re.sub(r'(FR)\d+', r'\1', t))
Standard input is empty
String_BA22_FR_BC String_BA22_FR_BC
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!