I didn't mean trying to show off or anything; I was just trying to find an inventive way to go about the generic method of a snippet. This is a part of my learning experience.
phil24, if you despise regex, you'll never learn of its benefits for many coding situations. Regex is universal and recognized by many programming languages. So try to get acquainted with it and you might like it gradually.