#!/usr/bin/python import re #import the regular expression module line = "Upgrade the PSI3 program to PSI4. PSI3 was an excellent program." matchstr = re.split("PSI3", line) for i in matchstr: print i