import retext = """Hello my name is John name What is your name"""print( re.sub(r'(?i)(?<!\S)(?!name(?!\S))\S+', "-", text) )
Standard input is empty
- - name - - name - - - name
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!