 <p>I suppose it is mandatory to use regex in your assignment... if not i would go for an xml parser...</p> <p>But if YES I suggest you have a go with <a href="http://www.regextools.com/adfetch.php?page=buddy/test.html&amp;adref=google_regex-testergoogle_regex-tool-powerful" rel="nofollow">Reg Ex buddy</a></p> <p>RegexBuddy makes it easier than ever for you to create regular expressions that do what you intend, without any guesswork. Still, you need to test your regex patterns to be 100% sure that they match what you want, and don't match what you don't want.</p>