Suggestion:  These kinds of things tend to be a little more reliable over the long-term when done with regular expressions.  What you have here is fine for now though.