import re s = "Issued May2018No expiration date"pattern = r"(\d{4})No "print(re.sub(pattern, r"\1 - No ", s))
Standard input is empty
Issued May2018 - No expiration date
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!