import retext = "Hello. world. Hello!" print( re.sub(r'^([^.]*\.[^.]*)\.', r'\1_', text) )
Standard input is empty
Hello. world_ Hello!
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!