There may be times in OS X where in typing an e-mail, paper, or other body of text, you may find some characters you type be immediately replaced by some alternative text. While useful in some instances, such behaviors can be a burden in others. For instance, if you write papers and find the system is automatically switching the sequence “^2” into a superscript 2, this may be to your liking but this will also prevent you from using Spotlight as a quick way to calculate the square of a value. In other situations you might similarly find yourself deleting the substitution.
The underlying issue here is OS X’s text substitution, which is a component of its system-wide text-management services that include spell checking and smart punctuation management. For text substitution, you can enter a sequence of characters along with a replacement string, and have OS X quickly fill in your text. For instance, one of Apple’s default replacements is “omw” which switches to “On my Way!” whenever typed.
To turn this feature off for a given application, you will have to see if a setting for it is supported in the program. Not all applications and services that support text substitution will have this feature. Finally, you can disable this systemwide by going to the Keyboard system preferences and removing all substitutions listed in the Text tab.
While you can disable text substitution, another method of avoiding inadvertent substitutions is to change the approach you use for them. By default Apple presents substitutions to replace text you might directly type, such as “omw” or “^2”; however, this may have you frustrated when the system replaces the text you may wish to preserve in some contexts. Therefore, modify the substitution to only replace text specified by an indicator instead of that you might directly type.

Direct substitutions such as those in red above may cause inadvertent substitutions. Adding special characters of your choosing to indicate the substitution may make this feature far more usable.
For instance, instead of replacing “omw,” use “\omw”, “(omw)” or “>>omw” as the text to replace, and similarly use a stereotyped indicator of a slashes, dashes, parentheses, or other marks before any text substitutions. That way, whenever you want to replace text just keep in mind to supply your indicator mark, and let OS X do the rest. This will then free up your ability to type in other text-handling services without OS X switching things around on you.
There is another way to make this feature work conveniently – one which I haven’t seen implemented. I don’t mind the suggestion of a correction – which is frequently the wrong thing, e.g. gpm becomes pgm – but I want a simple keystroke that says “no thanks, keep the original”. Right now, continuing typing frequently winds up with the changed word, or hitting return may also accept the changed word and skip a line. Using the arrow key doesn’t do the right thing.
Is there a simple key stroke that moves on without changing the word? I haven’t found it yet. I usually have to back up several times and retype the word – a pain in the neck.
Try the escape key, which I think is equivalent to tap/clicking the “x” and rejects the suggested substitution.
Since I share the shortcuts with Macs and iOS devices, I chose not to use a character, but “xx” as my trigger. So, xxomw is “On my way!” xxsit is “Stuck in traffic”, etc. Easier than finding special characters on a small screen…