A common task when dealing with user input or text files is searching through that input and replacing literals, special characters (such as carriage-return/line feed pairs in files), or patterns (such as phone numbers, contractions, and so forth). In fact, I recently finished working on a chatterbot (an artificial-intelligence application that verbally responds to voice or keyboard input) where this very task was needed in order to "smooth out" the user's input into something that the bot could more readily understand and respond to.
Read more here.