import re print re.sub("(?<=[^a-zA-Z])pi(?=[^a-zA-Z])", "(math.pi)", "2pi3 + supirse")
Standard input is empty
2(math.pi)3 + supirse
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!