There are plenty of places on the web to find documentation on regular expressions, one good one I know of is at
http://www.regular-expressions.info/.
In this case, I think I'd recommend starting with a dictionary entry that is very simple, and editing the entry as needed. The simplest thing you can do is use a simple text match instead of a regular expression, like this:
Text Matching: Simple Text
hey!
Pronounce Using: Respell
hey,
The problem with using a simple text match instead of a regular expression is that it does not include a condition requiring the next word to start with a lower case letter. So the pronunciation correction will be applied even if "hey!" is really the end of a sentence.
If you want to use a regular expression, you could start with something simpler, and as needed, gradually build up to the more powerful expression Percy gave. You could start with this:
Text Matching: Regular Expression
(?<=\b)hey!(?= +(?-i)[a-z])
Pronounce Using: Respell
hey,
This regular expression is looking for the text "hey!", and requires a word boundary character (\b) to precede the word. The expression also requires one or more spaces, then a lower case letter to follow the word. You can always update the expression for cases it does not handle.
I think I'd start with the simple text match, see how it works out, and move on to regular expressions if needed.