There are libraries that others have painstakingly perfected for this task, if that is of help. I am not trying to skirt helping you, but you are not wanting to implement a trivial feature in your program. You just have to do some grunt work and write a parser, if you want to do it by hand.